9 ms·
dig1 remembered it right. This bug was introduced in man-pages 3.62: https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=3f89ae779fce17911a9
by jwilk 8y ago
dig1 remembered it right. This bug was introduced in man-pages 3.62:
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=3f89ae779fce17911a920267fbba1b6f17042e2b https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/...
- DSMan195276 8y agoHuh, well that's embarrassing. It looks like it's still in there too. I googled the man page but I guess I saw an older version. I might submit a patch if I find time. It should really be something like this: if (n > 0) { strncpy(buf, str, n - 1); buf[n - 1] = '\0'; } Of course, the error isn't super huge considering if you're using a zero-length buffer as a null-terminated string you're going to have other problems. But they still do check for 0, so IMO it's worth correcting.
- jwilk 8y agoMatthew Kilgore submitted patch to fix this: https://marc.info/?l=linux-man&m=152834469929748 https://marc.info/?l=linux-man&m=152834469929748
- dig1 8y agoHuh, I blindly pasted example assuming man pages are always right. Double check next time :D
- DSMan195276 8y agoYes, that would be me :)