diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2017-11-16 08:16:04 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2017-11-16 08:16:04 +0000 |
commit | ed5272f3c5e0ebdc324bc0fc716454e2cd23d6e9 (patch) | |
tree | c17e7744d9deca549f98a8c0c7efbf12b3fb6dd0 | |
parent | 5c49ef3711a012f58dde7ee147425a9226f0f4e9 (diff) |
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
-rw-r--r-- | lib/libc/stdio/vfwprintf.c | 22 |
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; } |