The Left variable should be a positive integer

The variable Left is supposed to hold only a positive quantity and was
being passed into functions that accept only size_t as input causing coverity
to throw a fit. Using a size_t type for Left works just fine.
Negative Returns, found by coverity.
This commit is contained in:
Simo Sorce 2016-07-25 04:39:40 -04:00 committed by Lev Walkin
parent e6b650a0d9
commit cd943c243d
1 changed files with 2 additions and 2 deletions

View File

@ -244,8 +244,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
ber_tlv_tag_t expected_tag;
ssize_t tl, ll, tlvl;
/* This one works even if (sel->left == -1) */
ssize_t Left = ((!sel||(size_t)sel->left >= size)
?(ssize_t)size:sel->left);
size_t Left = ((!sel||(size_t)sel->left >= size)
?size:(size_t)sel->left);
ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel,