diff options
author | 2016-08-24 18:35:12 +0000 | |
---|---|---|
committer | 2016-08-24 18:35:12 +0000 | |
commit | 09eefa9f988a3d5ab04ad5722982447d7a7d3c97 (patch) | |
tree | 79d22efe47b29bbd070404c78ac2821753d98730 /lib/libc/stdio | |
parent | Since the removal of rwhod and friends a couple of years ago, there (diff) | |
download | wireguard-openbsd-09eefa9f988a3d5ab04ad5722982447d7a7d3c97.tar.xz wireguard-openbsd-09eefa9f988a3d5ab04ad5722982447d7a7d3c97.zip |
set the error indicator on malloc(3) failure;
from Andrey Chernov <ache at freebsd dot org>;
OK millert@
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r-- | lib/libc/stdio/fgetwln.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/fgetwln.c b/lib/libc/stdio/fgetwln.c index 37fcf3a1aee..2ee7e8d61e6 100644 --- a/lib/libc/stdio/fgetwln.c +++ b/lib/libc/stdio/fgetwln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetwln.c,v 1.2 2016/08/21 21:10:52 schwarze Exp $ */ +/* $OpenBSD: fgetwln.c,v 1.3 2016/08/24 18:35:12 schwarze Exp $ */ /*- * Copyright (c) 2002-2004 Tim J. Robbins. @@ -61,8 +61,10 @@ fgetwln(FILE * __restrict fp, size_t *lenp) while ((wc = __fgetwc_unlock(fp)) != WEOF) { #define GROW 512 if (len >= fp->_lb._size / sizeof(wchar_t) && - __slbexpand(fp, len + GROW)) + __slbexpand(fp, len + GROW)) { + fp->_flags |= __SERR; goto error; + } *((wchar_t *)fp->_lb._base + len++) = wc; if (wc == L'\n') break; |