|
Date: Sat, 8 Aug 2015 19:25:13 +0200 From: Felix Janda <felix.janda@...teo.de> To: musl@...ts.openwall.com Subject: [PATCH] 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. --- src/stdio/tempnam.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stdio/tempnam.c b/src/stdio/tempnam.c index 45a5f26..b938b31 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); -- 2.4.6
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.