Module Name: src
Committed By: mrg
Date: Fri Oct 4 09:16:39 UTC 2019
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: bignum.c
src/sbin/nvmectl: bignum.c
Log Message:
avoid access uninitialised memory, found by gcc8, patch by agc@.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/nvmectl/bignum.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c:1.4 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c:1.5
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c:1.4 Mon Apr 17 19:50:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c Fri Oct 4 09:16:38 2019
@@ -2308,7 +2308,7 @@ fast_col_array_multiply(mp_int * a, mp_i
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] */
Index: src/sbin/nvmectl/bignum.c
diff -u src/sbin/nvmectl/bignum.c:1.2 src/sbin/nvmectl/bignum.c:1.3
--- src/sbin/nvmectl/bignum.c:1.2 Thu Feb 8 09:05:17 2018
+++ src/sbin/nvmectl/bignum.c Fri Oct 4 09:16:38 2019
@@ -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 <[email protected]>
@@ -2304,7 +2304,7 @@ fast_col_array_multiply(mp_int * a, mp_i
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] */