News for hackers. Stuff that matters.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by jonathankoren on Tuesday June 26, 2018 @12:17PM (#17401833)
There’s no reason to believe from these two lines that the memory is insufficiently allocated. It’s just two lines. The point wasn’t to share a safe string copy routine, the point of the post was to illustrate a single mistake.
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by zeusk on Tuesday June 26, 2018 @12:24PM (#17401918)
I'm not assuming that, but then you can't assume the memory is sufficient either. If the string is from network or user, then you can never assume the buffer to be of sufficient size (which they definitely do, because they aren't tracking how much of src was copied into allocated dst).
Re:Layoffs at Watson Health Reveal IBM’s Problem with AI by ploxiln on Tuesday June 26, 2018 @06:07PM (#17404354)
Each line, individually, is total nonsense.

It never makes sense to use strlen() for an argument to strncpy(). Only the size of the destination buffer makes sense for strncpy() (usually sizeof(dst)). For other cases you would probably use memcpy().