Skip to content

Commit a71114b

Browse files
Merge pull request #6702 from bandi13/ZD16572
Check the return value
2 parents 24f60cc + f1b4387 commit a71114b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

wolfcrypt/src/asn.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31698,9 +31698,16 @@ int StoreECC_DSA_Sig(byte* out, word32* outLen, mp_int* r, mp_int* s)
3169831698
}
3169931699
if (ret == 0) {
3170031700
/* Encode DSA signature into buffer. */
31701-
SetASN_Items(dsaSigASN, dataASN, dsaSigASN_Length, out);
31702-
/* Set the actual encoding size. */
31703-
*outLen = (word32)sz;
31701+
ret = SetASN_Items(dsaSigASN, dataASN, dsaSigASN_Length, out);
31702+
if (ret >= 0) {
31703+
if (ret == sz) {
31704+
/* Set the actual encoding size. */
31705+
*outLen = (word32)sz;
31706+
ret = 0;
31707+
} else {
31708+
ret = BAD_STATE_E;
31709+
}
31710+
}
3170431711
}
3170531712

3170631713
return ret;

0 commit comments

Comments
 (0)