|
|
|
|
|
by WalterBright
29 days ago
|
|
Whenever I review C code, I always look for the string functions. About 90% of the time, I find a bug in it. The bug is always about forgetting to account for the terminating 0 byte. The functions strncpy, snprintf, strncat, are fountains of bugs. |
|
I still use snprintf, though, because it is so darned useful. But I wrap it up in another function after carefully ensuring it is called correctly.