summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfwprintf.c
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2017-11-16 08:16:03 +0000
committertb <tb@openbsd.org>2017-11-16 08:16:03 +0000
commit09abd1b48deead689ab5fad5e11606eef5c8de28 (patch)
tree6832ad4905501dbb40a95679f20d093c207c6710 /lib/libc/stdio/vfwprintf.c
parentTweak bitmask calculation to match i386 and avoid clang warning. (diff)
downloadwireguard-openbsd-09abd1b48deead689ab5fad5e11606eef5c8de28.tar.xz
wireguard-openbsd-09abd1b48deead689ab5fad5e11606eef5c8de28.zip
Add error checking to some calls to __find_arguments(). Matches similar
changes by schwarze to vfprintf.c r1.71. Cherrypicked from android: https://github.com/aosp-mirror/platform_bionic/commit/5305a4d4a723b06494b93f2df81733b83a0c46d3 ok millert
Diffstat (limited to 'lib/libc/stdio/vfwprintf.c')
-rw-r--r--lib/libc/stdio/vfwprintf.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
index 6ee36fa4726..e28901508fa 100644
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfwprintf.c,v 1.18 2017/08/15 00:20:39 deraadt Exp $ */
+/* $OpenBSD: vfwprintf.c,v 1.19 2017/11/16 08:16:03 tb Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -426,7 +426,11 @@ __vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap)
int hold = nextarg; \
if (argtable == NULL) { \
argtable = statargtable; \
- __find_arguments(fmt0, orgap, &argtable, &argtablesiz); \
+ if (__find_arguments(fmt0, orgap, &argtable, \
+ &argtablesiz) == -1) { \
+ ret = -1; \
+ goto error; \
+ } \
} \
nextarg = n2; \
val = GETARG(int); \
@@ -540,8 +544,11 @@ reswitch: switch (ch) {
nextarg = n;
if (argtable == NULL) {
argtable = statargtable;
- __find_arguments(fmt0, orgap,
- &argtable, &argtablesiz);
+ if (__find_arguments(fmt0, orgap,
+ &argtable, &argtablesiz) == -1) {
+ ret = -1;
+ goto error;
+ }
}
goto rflag;
}
@@ -566,8 +573,11 @@ reswitch: switch (ch) {
nextarg = n;
if (argtable == NULL) {
argtable = statargtable;
- __find_arguments(fmt0, orgap,
- &argtable, &argtablesiz);
+ if (__find_arguments(fmt0, orgap,
+ &argtable, &argtablesiz) == -1) {
+ ret = -1;
+ goto error;
+ }
}
goto rflag;
}