C quiz: safely copying to bounded destination buffer char *dst=…, *src=…; size_t n=…; snprintf(dst, n, "%s", src); // 1 sprintf(dst, "%.*s", n, src); //2
-
Show this thread
Replying to @volatile_void
2 is UB because n has wrong type. :-)
12:04 PM - 8 Jan 2018
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.