diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 2009-11-25 04:27:55 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 2009-11-25 04:27:55 +0000 |
commit | ab5b2fafecf8a2abd3def2018459393046992df4 (patch) | |
tree | de117fc85f5356429d57eabe438f1669bbab5b22 /lib/libc/stdio/vfwprintf.c | |
parent | e40c32385d0574a75ddbe6d4e1400497189b3f6a (diff) | |
download | src-ab5b2fafecf8a2abd3def2018459393046992df4.tar.gz src-ab5b2fafecf8a2abd3def2018459393046992df4.zip |
In __mbsconv(), if prec was zero, nconv could have been used
uninitialized. Initialize it to a safe value so that there's no
chance of returning an error if stack garbage happens to be equal to
(size_t)-1 or (size_t)-2.
Found by: Clang static analyzer
MFC after: 7 days
Notes
Notes:
svn path=/head/; revision=199782
Diffstat (limited to 'lib/libc/stdio/vfwprintf.c')
-rw-r--r-- | lib/libc/stdio/vfwprintf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index f3768de8d193..d34f559a8f3b 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -293,7 +293,7 @@ __mbsconv(char *mbsarg, int prec) * number of characters to print. */ p = mbsarg; - insize = nchars = 0; + insize = nchars = nconv = 0; mbs = initial_mbs; while (nchars != (size_t)prec) { nconv = mbrlen(p, MB_CUR_MAX, &mbs); |