Source-Changes-HG archive

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

[src/trunk]: src/libexec/httpd - don't use alloca and then check if alloca re...



details:   https://anonhg.NetBSD.org/src/rev/f7db0d974cd7
branches:  trunk
changeset: 811467:f7db0d974cd7
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 30 23:21:05 2015 +0000

description:
- don't use alloca and then check if alloca returns null and then try to
  free it. Allocating from the stack does not return null, and freeing it
  will have unpredictable results. use malloc instead.
- now we are using malloc remove -Wno-stack-protector kludge

diffstat:

 libexec/httpd/Makefile    |  5 +----
 libexec/httpd/bozohttpd.c |  4 ++--
 2 files changed, 3 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r 3342a57abd4e -r f7db0d974cd7 libexec/httpd/Makefile
--- a/libexec/httpd/Makefile    Fri Oct 30 23:06:49 2015 +0000
+++ b/libexec/httpd/Makefile    Fri Oct 30 23:21:05 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.25 2015/10/30 18:53:26 tron Exp $
+#      $NetBSD: Makefile,v 1.26 2015/10/30 23:21:05 christos Exp $
 #
 #      $eterna: Makefile,v 1.30 2010/07/11 00:34:27 mrg Exp $
 #
@@ -48,9 +48,6 @@
 LDADD+=                -lnbutil
 .endif
 
-COPTS.bozohttpd.c=     -Wno-stack-protector
-
-
 .include <bsd.own.mk>
 
 .if ${MKCRYPTO} != "no"
diff -r 3342a57abd4e -r f7db0d974cd7 libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Fri Oct 30 23:06:49 2015 +0000
+++ b/libexec/httpd/bozohttpd.c Fri Oct 30 23:21:05 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.c,v 1.67 2015/10/28 09:20:15 shm Exp $       */
+/*     $NetBSD: bozohttpd.c,v 1.68 2015/10/30 23:21:05 christos Exp $  */
 
 /*     $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $      */
 
@@ -1946,7 +1946,7 @@
                        else
                                user_alloc = 1;
                        /* expand username to ~user/ */
-                       user = alloca(strlen(user_escaped) + 3);
+                       user = malloc(strlen(user_escaped) + 3);
                        if (user != NULL) {
                                strcpy(user, "~");
                                strcat(user, user_escaped);



Home | Main Index | Thread Index | Old Index