From: Rich Felker Date: Sun, 9 Aug 2015 22:51:09 +0000 (+0000) Subject: fix failure of tempnam to null-terminate result X-Git-Tag: v1.1.11~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=062bb737de06c3906b4b4a07c7fc0fb286287efe;p=oweals%2Fmusl.git 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. --- 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