summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-04-14 07:25:05 +0000
committerpeter <peter@FreeBSD.org>1998-04-14 07:25:05 +0000
commit9da325cc05abd9ce39a313c56e2aec7c841cef07 (patch)
tree0a55a210db412e832ff98a9cf69d86e2f76f4f0a /lib/libc
parentced7ca4b356915288bb3cee56d8191995248653b (diff)
downloadFreeBSD-src-9da325cc05abd9ce39a313c56e2aec7c841cef07.zip
FreeBSD-src-9da325cc05abd9ce39a313c56e2aec7c841cef07.tar.gz
Fix a nasty flaw as a result of using the arc4random() pre-seeding of
leading XXX's. It could wrap an uppercase character through chars like: [ \ ] ^ _ ` in between Z and a. The backslash and back tick might be particularly nasty in a shell script context. Also, since we've been using upper-case generated values for a while now, go with the flow and use them in the pathname search rotation.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/mktemp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index 1987d69..ca3fa5b 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: mktemp.c,v 1.8 1998/02/13 02:13:24 imp Exp $";
+ "$Id: mktemp.c,v 1.9 1998/03/03 14:38:36 bde Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -164,11 +164,13 @@ _gettemp(path, doopen, domkdir)
for (trv = start;;) {
if (!*trv)
return(0);
- if (*trv == 'z')
+ if (*trv == 'Z')
*trv++ = 'a';
else {
if (isdigit(*trv))
*trv = 'a';
+ else if (*trv == 'z') /* inc from z to A */
+ *trv = 'A';
else
++*trv;
break;
OpenPOWER on IntegriCloud