aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio/mktemp.c
diff options
context:
space:
mode:
authorRobert Drehmel <robert@FreeBSD.org>2002-05-23 14:21:02 +0000
committerRobert Drehmel <robert@FreeBSD.org>2002-05-23 14:21:02 +0000
commitccccc4e1c30b19912fe9681d6097edfb7fd11991 (patch)
tree0ed7fada3c34a8ff733f955a82139978d839193c /lib/libc/stdio/mktemp.c
parent0bf831c43ef8b5e048ec5b8ba5aa5d587924e6dc (diff)
downloadsrc-ccccc4e1c30b19912fe9681d6097edfb7fd11991.tar.gz
src-ccccc4e1c30b19912fe9681d6097edfb7fd11991.zip
Avoid wandering over the beginning of the actual buffer
if the passed template string contains only 'X' characters. Submitted by: Mark Andrews <marka@isc.org> (patch modified) PR: 38402
Notes
Notes: svn path=/head/; revision=97168
Diffstat (limited to 'lib/libc/stdio/mktemp.c')
-rw-r--r--lib/libc/stdio/mktemp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index 826f2bc013ee..49ba17d2f420 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -128,7 +128,7 @@ _gettemp(path, doopen, domkdir, slen)
}
/* Fill space with random characters */
- while (*trv == 'X') {
+ while (trv >= path && *trv == 'X') {
rand = arc4random() % (sizeof(padchar) - 1);
*trv-- = padchar[rand];
}