Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
fractalb
on April 7, 2023
|
parent
|
context
|
favorite
| on:
C Strings and my slow descent to madness
snprintf(buf, 80, “%s”, argv[1]);
Should work.
alxmdev
on April 7, 2023
|
next
[–]
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
on April 7, 2023
|
prev
[–]
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: