diff options
author | cperciva <cperciva@FreeBSD.org> | 2008-08-04 06:55:42 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2008-08-04 06:55:42 +0000 |
commit | 5b18df3c7320c50e7b637d1154acf50eb81c99e8 (patch) | |
tree | 6d9671173aa0f159d0b755b7bf8934d08f2687ab /lib/libc | |
parent | f33a169622381195f221b9372e38ab0a5ac83428 (diff) | |
download | FreeBSD-src-5b18df3c7320c50e7b637d1154acf50eb81c99e8.zip FreeBSD-src-5b18df3c7320c50e7b637d1154acf50eb81c99e8.tar.gz |
Initialize "nconv" to a reasonable value in all code paths. Prior to
this commit, sprintf("%s", "") could fail depending on what happened
to be on the stack.
Found by: LLVM/Clang Static Checker
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/vfwprintf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index 6b4e9b1..dcd0f14 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -333,8 +333,10 @@ __mbsconv(char *mbsarg, int prec) } if (nconv == (size_t)-1 || nconv == (size_t)-2) return (NULL); - } else + } else { insize = strlen(mbsarg); + nconv = 0; + } /* * Allocate buffer for the result and perform the conversion, |