[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    incorect (?) execution of gziped executable
From:       Igor Khasilev <igor () jabber ! paco ! odessa ! ua>
Date:       1996-07-30 15:34:14
[Download RAW message or body]

Hi everybody!

Is it right that code become writeable in gziped executable?

I tried such program:
-------8<--------------------
sub()
{
	printf("sub\n");
}
main()
{
	printf("before: %x\n",*(int*)&sub);
	*(int*)&sub = 0;
	printf("after: %x\n", *(int*)&sub);
	sub();
}
-------8<--------------------

when compiled and executed normally (before gziping executable file)
it produce normal output:

bash$ ./x
before: 68e58955
Bus error (core dumped)
bash$

gdb display that program was terminated with signal 10 at line

        *(int*)&sub = 0;

Nothing unusual...

But...

bash$ gzip x
gzip: x.gz already exists; do you wish to overwrite (y or n)? y
bash$ ./x.gz 
before: 68e58955
after: 0
Segmentation fault (core dumped)
bash$

I become able to write to code? Or i misunderstand something?


Regads!

				Igor.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic