summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-08-09 22:51:09 +0000
committerRich Felker <dalias@aerifal.cx>2015-08-09 22:51:09 +0000
commit062bb737de06c3906b4b4a07c7fc0fb286287efe (patch)
tree641e2d7f18cfcd1c70b0e651f55f671c12d932ce /src/stdio
parentc3761622e8168b0c6453637ac82e70b09af3e8e9 (diff)
downloadmusl-062bb737de06c3906b4b4a07c7fc0fb286287efe.tar.gz
musl-062bb737de06c3906b4b4a07c7fc0fb286287efe.tar.bz2
musl-062bb737de06c3906b4b4a07c7fc0fb286287efe.tar.xz
musl-062bb737de06c3906b4b4a07c7fc0fb286287efe.zip
fix failure of tempnam to null-terminate result
tempnam uses an uninitialized buffer which is filled using memcpy and __randname. It is therefore necessary to explicitly null-terminate it. based on patch by Felix Janda.
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/tempnam.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stdio/tempnam.c b/src/stdio/tempnam.c
index 45a5f266..5a559752 100644
--- a/src/stdio/tempnam.c
+++ b/src/stdio/tempnam.c
@@ -33,6 +33,7 @@ char *tempnam(const char *dir, const char *pfx)
s[dl] = '/';
memcpy(s+dl+1, pfx, pl);
s[dl+1+pl] = '_';
+ s[l] = 0;
for (try=0; try<MAXTRIES; try++) {
__randname(s+l-6);