Blame SOURCES/opensc-0.20.0-CVE-2020-26570.patch
|
|
176fa0 |
commit 6903aebfddc466d966c7b865fae34572bf3ed23e
|
|
|
176fa0 |
Author: Frank Morgner <frankmorgner@gmail.com>
|
|
|
176fa0 |
Date: Thu Jul 30 02:21:17 2020 +0200
|
|
|
176fa0 |
|
|
|
176fa0 |
Heap-buffer-overflow WRITE
|
|
|
176fa0 |
|
|
|
176fa0 |
fixes https://oss-fuzz.com/testcase-detail/5088104168554496
|
|
|
176fa0 |
|
|
|
176fa0 |
diff --git a/src/libopensc/pkcs15-oberthur.c b/src/libopensc/pkcs15-oberthur.c
|
|
|
176fa0 |
index a873aaa0..2fb32b8d 100644
|
|
|
176fa0 |
--- a/src/libopensc/pkcs15-oberthur.c
|
|
|
176fa0 |
+++ b/src/libopensc/pkcs15-oberthur.c
|
|
|
176fa0 |
@@ -271,11 +271,15 @@ sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path,
|
|
|
176fa0 |
rv = sc_read_binary(card, 0, *out, sz, 0);
|
|
|
176fa0 |
}
|
|
|
176fa0 |
else {
|
|
|
176fa0 |
- int rec;
|
|
|
176fa0 |
- int offs = 0;
|
|
|
176fa0 |
- int rec_len = file->record_length;
|
|
|
176fa0 |
+ size_t rec;
|
|
|
176fa0 |
+ size_t offs = 0;
|
|
|
176fa0 |
+ size_t rec_len = file->record_length;
|
|
|
176fa0 |
|
|
|
176fa0 |
for (rec = 1; ; rec++) {
|
|
|
176fa0 |
+ if (rec > file->record_count) {
|
|
|
176fa0 |
+ rv = 0;
|
|
|
176fa0 |
+ break;
|
|
|
176fa0 |
+ }
|
|
|
176fa0 |
rv = sc_read_record(card, rec, *out + offs + 2, rec_len, SC_RECORD_BY_REC_NR);
|
|
|
176fa0 |
if (rv == SC_ERROR_RECORD_NOT_FOUND) {
|
|
|
176fa0 |
rv = 0;
|