Source-Changes-HG archive

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

[src/trunk]: src avoid access uninitialised memory, found by gcc8, patch by a...



details:   https://anonhg.NetBSD.org/src/rev/9dfdfcf71496
branches:  trunk
changeset: 460004:9dfdfcf71496
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Oct 04 09:16:38 2019 +0000

description:
avoid access uninitialised memory, found by gcc8, patch by agc@.

diffstat:

 crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c |  2 +-
 sbin/nvmectl/bignum.c                                     |  4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 900b7537b85d -r 9dfdfcf71496 crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c Fri Oct 04 09:01:59 2019 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c Fri Oct 04 09:16:38 2019 +0000
@@ -2308,7 +2308,7 @@
                tmpc = c->dp;
                for (ix = 0; ix < pa+1; ix++) {
                        /* now extract the previous digit [below the carry] */
-                       *tmpc++ = W[ix];
+                       *tmpc++ = (ix < pa) ? W[ix] : 0;
                }
 
                /* clear unused digits [that existed in the old copy of c] */
diff -r 900b7537b85d -r 9dfdfcf71496 sbin/nvmectl/bignum.c
--- a/sbin/nvmectl/bignum.c     Fri Oct 04 09:01:59 2019 +0000
+++ b/sbin/nvmectl/bignum.c     Fri Oct 04 09:16:38 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bignum.c,v 1.2 2018/02/08 09:05:17 dholland Exp $      */
+/*     $NetBSD: bignum.c,v 1.3 2019/10/04 09:16:38 mrg Exp $   */
 
 /*-
  * Copyright (c) 2012 Alistair Crooks <agc%NetBSD.org@localhost>
@@ -2304,7 +2304,7 @@
                tmpc = c->dp;
                for (ix = 0; ix < pa+1; ix++) {
                        /* now extract the previous digit [below the carry] */
-                       *tmpc++ = W[ix];
+                       *tmpc++ = (ix < pa) ? W[ix] : 0;
                }
 
                /* clear unused digits [that existed in the old copy of c] */



Home | Main Index | Thread Index | Old Index