summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/lynx
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-10-13 17:02:03 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-10-13 17:02:03 +0000
commit1a1944dfc1e22578a03cc8e61bd653b5bfb2b83c (patch)
tree0e105319d3905ce83a190e9278b01f69c337a1ed /gnu/usr.bin/lynx
parent3bdaed0431fd2a2dcb274afe6bc2a3e9173bc3e0 (diff)
Add check for mkdtemp(3) failure. Prevents segfaults when TMPDIR
or TMP are set to nonexistent directories. Fixes PR 5247, reported by Marcus Popp <mpopp at paranoidbsd dot org> OK millert@, jaredy@, and improvement by moritz@.
Diffstat (limited to 'gnu/usr.bin/lynx')
-rw-r--r--gnu/usr.bin/lynx/src/LYMain.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gnu/usr.bin/lynx/src/LYMain.c b/gnu/usr.bin/lynx/src/LYMain.c
index 8c950b1d2fc..2b7b3b8ccbd 100644
--- a/gnu/usr.bin/lynx/src/LYMain.c
+++ b/gnu/usr.bin/lynx/src/LYMain.c
@@ -1201,6 +1201,10 @@ PUBLIC int main ARGS2(
}
StrAllocCat(lynx_temp_space, "/lynx-XXXXXXXXXX");
lynx_temp_space = mkdtemp(lynx_temp_space);
+ if (lynx_temp_space == NULL) {
+ fprintf(stderr, "temporary directory: %s\n", LYStrerror(errno));
+ exit(EXIT_FAILURE);
+ }
#ifdef VMS
LYLowerCase(lynx_temp_space);
if (strchr(lynx_temp_space, '/') != NULL) {