diff --git a/lib/libc/stdio/fgetws.c b/lib/libc/stdio/fgetws.c index 9b7075d3c252..b6ef01e5c0af 100644 --- a/lib/libc/stdio/fgetws.c +++ b/lib/libc/stdio/fgetws.c @@ -74,7 +74,8 @@ fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp) * after the null. */ nconv++; - src = memchr(fp->_p, '\0', fp->_r) + 1; + src = memchr(fp->_p, '\0', fp->_r); + src++; } fp->_r -= (unsigned char *)src - fp->_p; fp->_p = (unsigned char *)src; diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index 12789fd5619e..d24addd270a8 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -166,10 +166,12 @@ main(int argc, char *argv[]) p++; } else if (!all) { /* Skip the first line, since it is probably incomplete. */ - p = memchr(p, '\n', ep - p) + 1; + p = memchr(p, '\n', ep - p); + p++; } for (; p < ep; p = nextp) { - nextp = memchr(p, '\n', ep - p) + 1; + nextp = memchr(p, '\n', ep - p); + nextp++; /* Skip ^<[0-9]+> syslog sequences. */ if (*p == '<') {