Only look within the note section for the version note.

If there is no version note found the loop will look past the end of
the elf section. Fix this by checking if we are still within it.