开发者

Sanity of appending data to an executable binary

开发者 https://www.devze.com 2023-01-21 18:04 出处:网络
Is it generally sane to append some random data to an executable binary file? What measures should be taken to ensure safe operation of the resulting executable, like padding before appended data or w

Is it generally sane to append some random data to an executable binary file? What measures should be taken to ensure safe operation of the resulting executable, like padding before appended data or whatever?

A typical C example would be:

gcc -o main.o -c main.c
gcc -o main main.o -lfoo
cat bar.txt >> main

The target system is broadly Uni开发者_Python百科x but a breakdown by system (Mac OS X, Linux, AIX...) is welcome if need be. A Windows point of view is welcome too for the sake of completeness.


This should be possible without issues, because in the ELF format the size of the program object should be specified and therefore only the data that should get loaded and executed gets loaded and executed.

0

精彩评论

暂无评论...
验证码 换一张
取 消