From 9da325cc05abd9ce39a313c56e2aec7c841cef07 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 14 Apr 1998 07:25:05 +0000 Subject: 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. --- lib/libc/stdio/mktemp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/libc/stdio/mktemp.c') 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 @@ -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; -- cgit v1.1