Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    snprintf(buf, 80, “%s”, argv[1]);
Should work.


Bingo, you should never pass arbitrary strings where they could be used as format specifiers, it's like running arbitrary code. Some compilers even issue warnings when you pass non-literal format strings to the printf family.


As long as you replace the 'smart'-quotes with actual quotes.

-Emily




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: