4 ms·
Thanks, I will make the necessary corrections shortly. The strncat() behavior is quite confusing. I can understand expecting the buffer to already be null-padd
by byuu 15y ago
Thanks, I will make the necessary corrections shortly.
The strncat() behavior is quite confusing. I can understand expecting the buffer to already be null-padded and skipping that step, but always null-terminating the result seems to go against strncpy()'s expected behavior. It also looks mildly dangerous, as the NUL-write can be one after the size given.
- caf 15y agoIt's not confusing when you realise that strncat() is not a concatenating analogue of strncpy(). It's just a version of strcat() that accepts an upper bound on the number of characters copied.