projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c376162
)
fix failure of tempnam to null-terminate result
author
Rich Felker
<dalias@aerifal.cx>
Sun, 9 Aug 2015 22:51:09 +0000
(22:51 +0000)
committer
Rich Felker
<dalias@aerifal.cx>
Sun, 9 Aug 2015 22:51:09 +0000
(22:51 +0000)
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.
src/stdio/tempnam.c
patch
|
blob
|
history
diff --git
a/src/stdio/tempnam.c
b/src/stdio/tempnam.c
index 45a5f266100db36970b528fadbd1ffac710f9cf8..5a5597527c0851d5d2c45fff1c6f1e2459e81375 100644
(file)
--- 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);