From d4b0d7e362eb2d7cd1daad1f47e370fa4059e82e Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 30 Oct 2015 23:21:05 +0000 Subject: - 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 --- libexec/httpd/Makefile | 5 +---- libexec/httpd/bozohttpd.c | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'libexec') diff --git a/libexec/httpd/Makefile b/libexec/httpd/Makefile index e2eab48a34a..7541b241ced 100644 --- a/libexec/httpd/Makefile +++ b/libexec/httpd/Makefile @@ -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 @@ CPPFLAGS+= -DHAVE_NBUTIL_H LDADD+= -lnbutil .endif -COPTS.bozohttpd.c= -Wno-stack-protector - - .include .if ${MKCRYPTO} != "no" diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c index 5b060f3aefa..42f6a18c548 100644 --- a/libexec/httpd/bozohttpd.c +++ b/libexec/httpd/bozohttpd.c @@ -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 @@ bozo_http_error(bozohttpd_t *httpd, int code, bozo_httpreq_t *request, 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); -- cgit