Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

safe sprintf snprintf(3) considered harmful

Name: Anonymous 2008-09-30 14:21

You should use int _snprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *format,... ); instead.

Name: Anonymous 2008-10-01 2:35

fuck all this talk of "safe" code, just check your input size if it's fixed, or use dynamically expanding buffers if it's not.

and if you can't prove an upper bound on the length of the data you're generating and supplying to sprintf, then you shouldn't be programming.

it's as simple as that.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List