Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
fractalb
· 3y ago · 0 comments
snprintf(buf, 80, “%s”, argv[1]);
Should work.
Comments
[–]
alxmdev
3y ago
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.
[–]
LoganDark
3y ago
As long as you replace the 'smart'-quotes with actual quotes.
-Emily