Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/netpgpverify Avoid segv ...
details: https://anonhg.NetBSD.org/src/rev/9a8c74bc6187
branches: trunk
changeset: 347501:9a8c74bc6187
user: christos <christos%NetBSD.org@localhost>
date: Sun Aug 28 15:52:22 2016 +0000
description:
Avoid segv when the end signature is not found!
diffstat:
crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r fcf62aec5d16 -r 9a8c74bc6187 crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c Sun Aug 28 14:23:00 2016 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c Sun Aug 28 15:52:22 2016 +0000
@@ -2016,7 +2016,7 @@
litdata.s.data = p;
litdata.u.litdata.offset = (size_t)(p - mem->mem);
litdata.u.litdata.filename = (uint8_t *)strdup(filename);
- if ((p = find_bin_string(datastart = p, mem->size - litdata.offset, SIGSTART, strlen(SIGSTART))) == NULL) {
+ if ((p = find_bin_string(datastart = p, mem->size - litdata.offset, SIGSTART, sizeof(SIGSTART) - 1)) == NULL) {
snprintf(cursor->why, sizeof(cursor->why),
"malformed armor - no sig - at %zu", (size_t)(p - mem->mem));
return 0;
@@ -2030,7 +2030,13 @@
return 0;
}
p += 2;
- sigend = find_bin_string(p, mem->size, SIGEND, strlen(SIGEND));
+ sigend = find_bin_string(p, mem->size, SIGEND, sizeof(SIGEND) - 1);
+ if (sigend == NULL) {
+ snprintf(cursor->why, sizeof(cursor->why),
+ "malformed armor - no end sig - at %zu",
+ (size_t)(p - mem->mem));
+ return 0;
+ }
binsigsize = b64decode((char *)p, (size_t)(sigend - p), binsig, sizeof(binsig));
read_binary_memory(cursor->pgp, "signature", cons_onepass, 15);
Home |
Main Index |
Thread Index |
Old Index