Re: smaller f00f.c
![](https://secure.gravatar.com/avatar/9f6867ec8295f506f9bfa15e1db9f18b.jpg?s=120&d=mm&r=g)
Adam says:
Hey, challenge is on:
main(){int i=0xc8c70ff0;void (*f)()=&i;f();} /* f00fies 44 char */ main(){((int(*)())"\360\017\307\310")();} main(){int i=0xc8c70ff0,(*f)()=&i;f();} main(i){int(*f)()=&i;i=0xc8c70ff0;f();} main(i){i=0xc8c70ff0;((int(*)())&i)();} (*f)();main(i){f=&i;i=0xc8c70ff0;f();} (*f)()="\360\017\307\310";main(){f();} /* 38 chars */
Compiled with gcc.
long main=0xc8c70ff0; /* also gcc; 21 chars, and not my invention */ Without the "long" you get a warning, but it compiles anyway... 16 chars. Jim Gillogly jim@acm.org
![](https://secure.gravatar.com/avatar/a57e37ac90cde6088c9d7e9b99436994.jpg?s=120&d=mm&r=g)
Jim Gillogly <jim@mentat.com> writes: (Jim Gillogly)
Adam says:
(*f)()="\360\017\307\310";main(){f();} /* 38 chars */
Compiled with gcc.
long main=0xc8c70ff0; /* also gcc; 21 chars, and not my invention */ Without the "long" you get a warning, but it compiles anyway... 16 chars.
Wow! Completely out-classed :-) I did try this one in my efforts: main="\360\017\307\310"; which compiles, but obviously doesn't work. So... I see the light now: you can write var=5; and it'll assume int, and so if you do main=5; it will create asm label _main against a memory location initialised to that constant ... due to lack of type checking, that'll make the linker happy and voila. Excellent. Adam -- Now officially an EAR violation... Have *you* exported RSA today? --> http://www.dcs.ex.ac.uk/~aba/rsa/ print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<> )]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc`
participants (2)
-
Adam Back
-
jim@mentat.com