Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/rsh more GCC 10 fixes.



details:   https://anonhg.NetBSD.org/src/rev/586a0c6661e6
branches:  trunk
changeset: 961242:586a0c6661e6
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Apr 13 06:25:48 2021 +0000

description:
more GCC 10 fixes.

mDNSResponder: another wrong return local address

dhcp: ignore a seemingly impossible stringop overflow

hpacel: avoid maybe uninitialised error that is wrong.

rsh: avoid impossible malloc(0)

udf: cast pointers through (uintptr_t) to fool invalid boundary checks

diffstat:

 external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile |   4 +++-
 external/mpl/dhcp/bin/server/Makefile                  |   3 ++-
 sbin/newfs_udf/udf_create.c                            |  10 +++++-----
 sys/fs/udf/udf_subr.c                                  |  11 ++++++-----
 sys/modules/hpacel/Makefile                            |   4 +++-
 usr.bin/rsh/rsh.c                                      |   6 ++++--
 6 files changed, 23 insertions(+), 15 deletions(-)

diffs (158 lines):

diff -r ad12c236351c -r 586a0c6661e6 external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile
--- a/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile    Tue Apr 13 05:58:45 2021 +0000
+++ b/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile    Tue Apr 13 06:25:48 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.13 2020/09/06 07:20:26 mrg Exp $
+#      $NetBSD: Makefile,v 1.14 2021/04/13 06:25:48 mrg Exp $
 
 PROG=  mdnsd
 
@@ -20,4 +20,6 @@
 CWARNFLAGS.clang+=     -Wno-unused-value -Wno-error=address-of-packed-member
 CWARNFLAGS.gcc+=       ${GCC_NO_ADDR_OF_PACKED_MEMBER}
 
+COPTS.DNSCommon.c+=    ${GCC_NO_RETURN_LOCAL_ADDR}
+
 .include <bsd.prog.mk>
diff -r ad12c236351c -r 586a0c6661e6 external/mpl/dhcp/bin/server/Makefile
--- a/external/mpl/dhcp/bin/server/Makefile     Tue Apr 13 05:58:45 2021 +0000
+++ b/external/mpl/dhcp/bin/server/Makefile     Tue Apr 13 06:25:48 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2020/06/07 23:29:16 fox Exp $
+# $NetBSD: Makefile,v 1.7 2021/04/13 06:25:48 mrg Exp $
 
 .include <bsd.own.mk>
 
@@ -22,5 +22,6 @@
 COPTS.mdb6.c +=                ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}
 COPTS.omapi.c +=       -Wno-stack-protector
 COPTS.confpars.c+=     ${GCC_NO_STRINGOP_TRUNCATION}
+COPTS.mdb6.c+=         ${GCC_NO_STRINGOP_OVERFLOW}
 
 .include <bsd.prog.mk>
diff -r ad12c236351c -r 586a0c6661e6 sbin/newfs_udf/udf_create.c
--- a/sbin/newfs_udf/udf_create.c       Tue Apr 13 05:58:45 2021 +0000
+++ b/sbin/newfs_udf/udf_create.c       Tue Apr 13 06:25:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_create.c,v 1.28 2020/05/14 08:34:18 msaitoh Exp $ */
+/* $NetBSD: udf_create.c,v 1.29 2021/04/13 06:25:48 mrg Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_create.c,v 1.28 2020/05/14 08:34:18 msaitoh Exp $");
+__RCSID("$NetBSD: udf_create.c,v 1.29 2021/04/13 06:25:48 mrg Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -2025,7 +2025,7 @@
        uint64_t inf_len, obj_size, logblks_rec;
        uint32_t l_ad, l_ea;
        uint16_t crclen;
-       uint8_t *bpos;
+       uintptr_t bpos;
 
        inf_len     = udf_rw64(efe->inf_len);
        obj_size    = udf_rw64(efe->obj_size);
@@ -2039,8 +2039,8 @@
        icb->flags = udf_rw16(UDF_ICB_SHORT_ALLOC);
 
        /* append short_ad */
-       bpos = (uint8_t *) efe->data + l_ea + l_ad;
-       memcpy(bpos, mapping, sizeof(struct short_ad));
+       bpos = (uintptr_t)efe->data + l_ea + l_ad;
+       memcpy((void *)bpos, mapping, sizeof(struct short_ad));
 
        l_ad   += sizeof(struct short_ad);
        crclen += sizeof(struct short_ad);
diff -r ad12c236351c -r 586a0c6661e6 sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Tue Apr 13 05:58:45 2021 +0000
+++ b/sys/fs/udf/udf_subr.c     Tue Apr 13 06:25:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.152 2021/01/11 22:02:28 skrll Exp $ */
+/* $NetBSD: udf_subr.c,v 1.153 2021/04/13 06:25:49 mrg Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.152 2021/01/11 22:02:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.153 2021/04/13 06:25:49 mrg Exp $");
 #endif /* not lint */
 
 
@@ -2664,7 +2664,8 @@
        const char *extstr = "*UDF VAT LVExtension";
        uint64_t    vat_uniqueid;
        uint32_t    offset, a_l;
-       uint8_t    *ea_start, *lvextpos;
+       uint8_t    *ea_start;
+       uintptr_t   lvextpos;
        int         error;
 
        /* get mountpoint and lvinfo */
@@ -2700,14 +2701,14 @@
         * copy first to avoid panics on some machines (!!)
         */
        DPRINTF(VOLUMES, ("Updating VAT LVExtension attr\n"));
-       lvextpos = implext->data + udf_rw32(implext->iu_l);
+       lvextpos = (uintptr_t)implext->data + udf_rw32(implext->iu_l);
 
        lvext.unique_id_chk   = vat_uniqueid;
        lvext.num_files       = lvinfo->num_files;
        lvext.num_directories = lvinfo->num_directories;
        memmove(lvext.logvol_id, ump->logical_vol->logvol_id, 128);
 
-       memcpy(lvextpos, &lvext, sizeof(lvext));
+       memcpy((void *)lvextpos, &lvext, sizeof(lvext));
 
        return 0;
 }
diff -r ad12c236351c -r 586a0c6661e6 sys/modules/hpacel/Makefile
--- a/sys/modules/hpacel/Makefile       Tue Apr 13 05:58:45 2021 +0000
+++ b/sys/modules/hpacel/Makefile       Tue Apr 13 06:25:48 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2019/02/17 04:05:50 rin Exp $
+# $NetBSD: Makefile,v 1.3 2021/04/13 06:25:49 mrg Exp $
 
 .include "../Makefile.inc"
 
@@ -8,4 +8,6 @@
 IOCONF=        hpacel.ioconf
 SRCS=  hpacel_acpi.c
 
+COPTS.hpacel_acpi.c+=       ${GCC_NO_MAYBE_UNINITIALIZED}
+
 .include <bsd.kmodule.mk>
diff -r ad12c236351c -r 586a0c6661e6 usr.bin/rsh/rsh.c
--- a/usr.bin/rsh/rsh.c Tue Apr 13 05:58:45 2021 +0000
+++ b/usr.bin/rsh/rsh.c Tue Apr 13 06:25:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rsh.c,v 1.38 2014/11/26 23:44:21 enami Exp $   */
+/*     $NetBSD: rsh.c,v 1.39 2021/04/13 06:25:49 mrg Exp $     */
 
 /*-
  * Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rsh.c      8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rsh.c,v 1.38 2014/11/26 23:44:21 enami Exp $");
+__RCSID("$NetBSD: rsh.c,v 1.39 2021/04/13 06:25:49 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -454,6 +454,8 @@
        cc = 0;
        for (ap = argv; *ap; ++ap)
                cc += strlen(*ap) + 1;
+       if (cc == 0)
+               usage();
        if (!(args = malloc((u_int)cc)))
                err(1, "malloc");
        ep = args + cc;



Home | Main Index | Thread Index | Old Index