# HG changeset patch # User Christian Urban # Date 1412433118 -3600 # Node ID 6740798264c15e229c2fde59452b513324922366 # Parent f7a9837a63b83e2a6b2472dc94ecdc4732d7baa3 aded C0 files diff -r f7a9837a63b8 -r 6740798264c1 Attic/programs/C0-long.c --- a/Attic/programs/C0-long.c Sat Oct 04 15:16:32 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#include -#include -#include - -/* - I used as environment the virtual machine provided here - - http://www.cis.upenn.edu/~cis551/box.tar - - This is Debian/Etch with Linux 2.6.18 with gcc 4.1.2 from 2008. - - Some installation notes for this virtual machine under VMWare - are here - - http://www.cis.upenn.edu/~cis551/project1.pdf - - I run the virtial machine under MacOSX using the program - VirtualBox available for free from - - https://www.virtualbox.org - - The C-program I compiled the program with - - gcc -ggdb -fno-stack-protector -mpreferred-stack-boundary=2 - - */ - - -void foo (char *bar) -{ - float my_float = 10.5; // in hex: \x41\x28\x00\x00 - char buffer[28]; - - printf("my float value = %f\n", my_float); - - strcpy(buffer, bar); - - printf("my float value = %f\n", my_float); -} - -int main (int argc, char **argv) -{ - foo("my string is too long !!!!! "); // all is normal - foo("my string is too long !!!!! \x10\x10\xc0\x42"); // overwrites my_float - return 0; -} - diff -r f7a9837a63b8 -r 6740798264c1 Attic/programs/C0.c --- a/Attic/programs/C0.c Sat Oct 04 15:16:32 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -#include -#include -#include - -void foo (char *bar) -{ - float my_float = 10.5; // in hex: \x41\x28\x00\x00 - char buffer[28]; - - printf("my float value = %f\n", my_float); - - strcpy(buffer, bar); - - printf("my float value = %f\n", my_float); -} - -int main (int argc, char **argv) -{ - foo("my string is too long !!!!! "); // all is normal - //foo("my string is too long !!!!! \x10\x10\xc0\x42"); // overwrites my_float - return 0; -} - diff -r f7a9837a63b8 -r 6740798264c1 progs/C0-long.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/progs/C0-long.c Sat Oct 04 15:31:58 2014 +0100 @@ -0,0 +1,47 @@ +#include +#include +#include + +/* + I used as environment the virtual machine provided here + + http://www.cis.upenn.edu/~cis551/box.tar + + This is Debian/Etch with Linux 2.6.18 with gcc 4.1.2 from 2008. + + Some installation notes for this virtual machine under VMWare + are here + + http://www.cis.upenn.edu/~cis551/project1.pdf + + I run the virtial machine under MacOSX using the program + VirtualBox available for free from + + https://www.virtualbox.org + + The C-program I compiled the program with + + gcc -ggdb -fno-stack-protector -mpreferred-stack-boundary=2 + + */ + + +void foo (char *bar) +{ + float my_float = 10.5; // in hex: \x41\x28\x00\x00 + char buffer[28]; + + printf("my float value = %f\n", my_float); + + strcpy(buffer, bar); + + printf("my float value = %f\n", my_float); +} + +int main (int argc, char **argv) +{ + foo("my string is too long !!!!! "); // all is normal + foo("my string is too long !!!!! \x10\x10\xc0\x42"); // overwrites my_float + return 0; +} + diff -r f7a9837a63b8 -r 6740798264c1 progs/C0.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/progs/C0.c Sat Oct 04 15:31:58 2014 +0100 @@ -0,0 +1,23 @@ +#include +#include +#include + +void foo (char *bar) +{ + float my_float = 10.5; // in hex: \x41\x28\x00\x00 + char buffer[28]; + + printf("my float value = %f\n", my_float); + + strcpy(buffer, bar); + + printf("my float value = %f\n", my_float); +} + +int main (int argc, char **argv) +{ + foo("my string is too long !!!!! "); // all is normal + //foo("my string is too long !!!!! \x10\x10\xc0\x42"); // overwrites my_float + return 0; +} + diff -r f7a9837a63b8 -r 6740798264c1 slides/slides03.pdf Binary file slides/slides03.pdf has changed