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