Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Shouldn't be. See the "exit 1" in your link? That's the end of the shell script, and as the OpenBSD link says;

> It remains possible to put arbitrary bytes AFTER the parts of the shell script that get parsed & executed (like some Solaris patch files do). But you can't put arbirary bytes in the middle,



It is. Binaries generated by cosmocc have NUL in the middle.


Ah, indeed. Here are the first 16 bytes of one:

4d 5a 71 46 70 44 3d 27 0a 00 00 10 00 f8 00 00 |MZqFpD='........|

There are already nul bytes here, and there are a lot more before the single quote gets closed at offset 0x200.


And I can confirm a NUL in 11th byte of my hello.c a.out:

  >>> s[:11]
  b"MZqFpD='\n\n\x00"
Looking closer, I missed the content of "BIOS BOOT SECTOR".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: