Source-Changes-HG archive

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

[src/trunk]: src/libexec/httpd libexec/httpd: Fix the possible -Werror=string...



details:   https://anonhg.NetBSD.org/src/rev/0ebb6a16f92b
branches:  trunk
changeset: 972784:0ebb6a16f92b
user:      fox <fox%NetBSD.org@localhost>
date:      Sun Jun 07 23:33:02 2020 +0000

description:
libexec/httpd: Fix the possible -Werror=stringop-truncation

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@, mrg@

diffstat:

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

diffs (18 lines):

diff -r babea191c0fa -r 0ebb6a16f92b libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Sun Jun 07 23:29:16 2020 +0000
+++ b/libexec/httpd/bozohttpd.c Sun Jun 07 23:33:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.c,v 1.113 2019/02/28 09:16:42 mrg Exp $      */
+/*     $NetBSD: bozohttpd.c,v 1.114 2020/06/07 23:33:02 fox Exp $      */
 
 /*     $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $      */
 
@@ -496,7 +496,7 @@
 
        if (strncasecmp(proto, "HTTP/", 5) != 0)
                goto bad;
-       strncpy(majorstr, proto + 5, sizeof majorstr);
+       strncpy(majorstr, proto + 5, sizeof(majorstr)-1);
        majorstr[sizeof(majorstr)-1] = 0;
        minorstr = strchr(majorstr, '.');
        if (minorstr == NULL)



Home | Main Index | Thread Index | Old Index