Module Name:    src
Committed By:   martin
Date:           Sun Jun 23 20:32:55 UTC 2013

Modified Files:
        src/libexec/httpd: bozohttpd.c

Log Message:
Do not keep pointers into a readdir result (which will become invalid
when closing the directory) - strdup() it instead.
Fixes the "bogus redirects" part of PR bin/47925 (atf test case
forthcoming)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/libexec/httpd/bozohttpd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.33 src/libexec/httpd/bozohttpd.c:1.34
--- src/libexec/httpd/bozohttpd.c:1.33	Sat Mar  9 21:36:04 2013
+++ src/libexec/httpd/bozohttpd.c	Sun Jun 23 20:32:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.33 2013/03/09 21:36:04 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.34 2013/06/23 20:32:55 martin Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -1076,7 +1076,7 @@ check_virtual(bozo_httpreq_t *request)
 				    len) == 0) {
 					/* found it, punch it */
 					debug((httpd, DEBUG_OBESE, "found it punch it"));
-					httpd->virthostname = d->d_name;
+					httpd->virthostname = strdup(d->d_name);
 					if (asprintf(&s, "%s/%s", httpd->virtbase,
 					    httpd->virthostname) < 0)
 						bozo_err(httpd, 1, "asprintf");

Reply via email to