Hacker News new | past | comments | ask | show | jobs | submit login

    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




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: