]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2012-03-02 Kees Cook <keescook@chromium.org>
authorKees Cook <keescook@chromium.org>
Mon, 5 Mar 2012 09:18:17 +0000 (10:18 +0100)
committerAndreas Jaeger <aj@suse.de>
Mon, 5 Mar 2012 09:18:17 +0000 (10:18 +0100)
        * stdio-common/vfprintf.c (vfprintf): add missing errno settings.

ChangeLog
stdio-common/vfprintf.c

index dad26dad010c7ba05f2540103c58cd86352a3a4b..0fe45655a9da7c9382b6911707ca5c6eb8c0d9af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2012-03-02  Kees Cook  <keescook@chromium.org>
 
+        * stdio-common/vfprintf.c (vfprintf): add missing errno settings.
+
         [BZ #13656]
         * stdio-common/vfprintf.c (vfprintf): Check for nargs overflow and
         possibly allocate from heap instead of stack.
index c802e4634914ce86e279d2693a3fa0093b32d782..85d19005d278521f4c16e5c2aa98222101ae39da 100644 (file)
@@ -822,7 +822,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
                                                                              \
        if (function_done < 0)                                                \
          {                                                                   \
-           /* Error in print handler.  */                                    \
+           /* Error in print handler; up to handler to set errno.  */        \
            done = -1;                                                        \
            goto all_done;                                                    \
          }                                                                   \
@@ -876,7 +876,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
                                                                              \
        if (function_done < 0)                                                \
          {                                                                   \
-           /* Error in print handler.  */                                    \
+           /* Error in print handler; up to handler to set errno.  */        \
            done = -1;                                                        \
            goto all_done;                                                    \
          }                                                                   \
@@ -1117,7 +1117,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
                         &mbstate);                                           \
        if (len == (size_t) -1)                                               \
          {                                                                   \
-           /* Something went wron gduring the conversion.  Bail out.  */     \
+           /* Something went wronduring the conversion.  Bail out.  */     \
            done = -1;                                                        \
            goto all_done;                                                    \
          }                                                                   \
@@ -1188,6 +1188,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
                      if (__mbsnrtowcs (ignore, &str2, strend - str2,         \
                                        ignore_size, &ps) == (size_t) -1)     \
                        {                                                     \
+                         /* Conversion function has set errno.  */           \
                          done = -1;                                          \
                          goto all_done;                                      \
                        }                                                     \
@@ -1605,6 +1606,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
          if (spec == L_('\0'))
            {
              /* The format string ended before the specifier is complete.  */
+             __set_errno (EINVAL);
              done = -1;
              goto all_done;
            }
@@ -1948,6 +1950,7 @@ do_positional:
                       about # of chars.  */
                    if (function_done < 0)
                      {
+                       /* Function has set errno.  */
                        done = -1;
                        goto all_done;
                      }
@@ -1982,6 +1985,7 @@ do_positional:
                 of chars.  */
              if (function_done < 0)
                {
+                 /* Function has set errno.  */
                  done = -1;
                  goto all_done;
                }