Originally Posted by
redone
how do i know the signature of the variable if possible give a source code example
thanksi advance
There may be some problems with this idea, in fact, altho I haven't done any reading about the structure of executables, so I'm kind of acting blindly, but:
Code:
#include <string.h>
int main() {
char sig[1029]="XOXOX", *start=&sig[5];
memset(start,'Z',1024);
strcpy(start,"hello world");
return 0;
}
Looking at that with hexdump -c ./a.out, it's possible to find XOXOX, or at least XOXO, which is to say that is not always contiguous. It is also possible to find "hello world", altho it is no where near XOXOX. And there is not a single Z in the file.
There are some interesting things in the hexdump that imply to me you could access the data segment without using libelf but probably not in as naive a way as this...
ps. anyone know why gcc's default output file is still called a.out? AFAIK an "a.out" binary is historically not the same as an ELF binary, but of course the a.out from gcc on linux is an ELF binary.