Skip to content

Commit 9fdb40c

Browse files
authored
Merge pull request #8790 from philljj/fix_coverity
coverity: misc fixes
2 parents 85a4e34 + c619c19 commit 9fdb40c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

wolfcrypt/src/asn.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41582,11 +41582,11 @@ static void PrintObjectIdText(Asn1* asn1, Asn1PrintOptions* opts)
4158241582
int nid;
4158341583
#endif
4158441584
const char* ln = NULL;
41585-
word32 i = 0;
41585+
word32 idx = 0;
4158641586
int known = 1;
4158741587

4158841588
/* Get the OID value for the OBJECT_ID. */
41589-
if (GetObjectId(asn1->data + asn1->offset, &i, &oid, oidIgnoreType,
41589+
if (GetObjectId(asn1->data + asn1->offset, &idx, &oid, oidIgnoreType,
4159041590
asn1->item.len + 2) == WC_NO_ERR_TRACE(ASN_PARSE_E)) {
4159141591
known = 0;
4159241592
}
@@ -41602,9 +41602,9 @@ static void PrintObjectIdText(Asn1* asn1, Asn1PrintOptions* opts)
4160241602
/* Lookup long name for extra known OID values. */
4160341603
if (Oid2LongName(oid, &ln) != 0) {
4160441604
}
41605-
else if ((asn1->nameCb != NULL) &&
41605+
else if ((asn1->nameCb != NULL) && (idx >= 2) &&
4160641606
((ln = asn1->nameCb(asn1->data + asn1->offset + 2,
41607-
i - 2))) != NULL) {
41607+
idx - 2))) != NULL) {
4160841608
}
4160941609
else {
4161041610
/* Unknown OID value. */

0 commit comments

Comments
 (0)