Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd Do not keep pointers into a readdir result (wh...



details:   https://anonhg.NetBSD.org/src/rev/6eeab5ccdc8b
branches:  trunk
changeset: 787558:6eeab5ccdc8b
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jun 23 20:32:55 2013 +0000

description:
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)

diffstat:

 libexec/httpd/bozohttpd.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r c7d3581c322d -r 6eeab5ccdc8b libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Sun Jun 23 19:24:08 2013 +0000
+++ b/libexec/httpd/bozohttpd.c Sun Jun 23 20:32:55 2013 +0000
@@ -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 @@
                                    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");



Home | Main Index | Thread Index | Old Index