mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Fix an off-by-one bug that caused the first character of the buffer to
be uninitialized.
This commit is contained in:
parent
ddabcdb433
commit
91f18ef928
1 changed files with 1 additions and 2 deletions
|
|
@ -46,11 +46,10 @@ fgetwln(FILE * __restrict fp, size_t *lenp)
|
|||
len = 0;
|
||||
while ((wc = __fgetwc(fp)) != WEOF) {
|
||||
#define GROW 512
|
||||
len++;
|
||||
if (len * sizeof(wchar_t) >= fp->_lb._size &&
|
||||
__slbexpand(fp, (len + GROW) * sizeof(wchar_t)))
|
||||
goto error;
|
||||
*((wchar_t *)fp->_lb._base + len) = wc;
|
||||
*((wchar_t *)fp->_lb._base + len++) = wc;
|
||||
if (wc == L'\n')
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue