mirror of
https://git.musl-libc.org/git/musl
synced 2025-03-23 19:13:01 +03:00
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.
This commit is contained in:
parent
c3761622e8
commit
062bb737de
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user