add comment on sanity check

This commit is contained in:
Jacob Barthelmeh 2018-02-27 23:30:50 -07:00
parent 00b6419964
commit 25e7dbd17a
1 changed files with 4 additions and 0 deletions

View File

@ -11146,6 +11146,10 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
if (ret == 0) {
ret = ASNToHexString(input, inOutIdx, (char**)&point, inSz,
key->heap, DYNAMIC_TYPE_ECC_BUFFER);
/* sanity check that point buffer is not smaller than the expected
* size to hold ( 0 4 || Gx || Gy )
* where Gx and Gy are each the size of curve->size * 2 */
if (ret == 0 && (int)XSTRLEN(point) < (curve->size * 4) + 2) {
XFREE(point, key->heap, DYNAMIC_TYPE_ECC_BUFFER);
ret = BUFFER_E;