As promised in my previous mail, here's the part of the android commit
https://github.com/aosp-mirror/platform_bionic/commit/5305a4d4a723b06494b93f2df81733b83a0c46d3
that adds some missing error checking analogous to some of the checking
added by schwarze in vfprintf.c r1.71.

ok?

Index: lib/libc/stdio/vfwprintf.c
===================================================================
RCS file: /var/cvs/src/lib/libc/stdio/vfwprintf.c,v
retrieving revision 1.18
diff -u -p -r1.18 vfwprintf.c
--- lib/libc/stdio/vfwprintf.c  15 Aug 2017 00:20:39 -0000      1.18
+++ lib/libc/stdio/vfwprintf.c  13 Nov 2017 23:16:05 -0000
@@ -426,7 +426,11 @@ __vfwprintf(FILE * __restrict fp, const 
                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;
                        }

Reply via email to