diff options
author | 2009-02-17 22:53:43 +0000 | |
---|---|---|
committer | 2009-02-17 22:53:43 +0000 | |
commit | 187ec98c6e3850465f2e76dfb6d1d5274675b154 (patch) | |
tree | 3e8b376fb3b0c77991bed6c3cf5feb62c9c0d075 /lib/libc/stdio/mktemp.c | |
parent | imsg_init depends on ibuf being calloc'd. fix few places where malloc (diff) | |
download | wireguard-openbsd-187ec98c6e3850465f2e76dfb6d1d5274675b154.tar.xz wireguard-openbsd-187ec98c6e3850465f2e76dfb6d1d5274675b154.zip |
when the template is entirely XXX characters, would crash
from Vadim Zhukov <persgray@gmail
ok millert
Diffstat (limited to 'lib/libc/stdio/mktemp.c')
-rw-r--r-- | lib/libc/stdio/mktemp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index b88ef741fd7..dcc50b7f0f9 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mktemp.c,v 1.24 2008/09/15 20:28:44 chl Exp $ */ +/* $OpenBSD: mktemp.c,v 1.25 2009/02/17 22:53:43 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. @@ -100,9 +100,11 @@ _gettemp(char *path, int *doopen, int domkdir, int slen) } ep = path + len - slen; - for (start = ep; *--start == 'X';) - ; - start++; + for (start = ep - 1; start != path; start--) + if (*start != 'X') { + start++; + break; + } for (;;) { for (cp = start; cp != ep; cp++) { |