From cf0816f41503c9a556373b37b987dcb7a9be040b Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 25 Jul 2016 05:39:44 -0400 Subject: Additional coverity fixes. This are manual fixes for patches submitted upstream, and should be picked up once a new asn1c is available. They will be overridden if the code is regenerated before then. Signed-off-by: Simo Sorce Reviewed-By: Martin Basti --- asn1/asn1c/OCTET_STRING.c | 13 ++----------- asn1/asn1c/constr_CHOICE.c | 1 - asn1/asn1c/der_encoder.c | 4 ++-- asn1/asn1c/per_support.c | 4 ++-- 4 files changed, 6 insertions(+), 16 deletions(-) (limited to 'asn1/asn1c') diff --git a/asn1/asn1c/OCTET_STRING.c b/asn1/asn1c/OCTET_STRING.c index f2eec13aa..17bfa8e97 100644 --- a/asn1/asn1c/OCTET_STRING.c +++ b/asn1/asn1c/OCTET_STRING.c @@ -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, @@ -483,15 +483,6 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, break; } - if(sel) { - ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", - sel->prev, sel->want_nulls, - (long)sel->left, (long)sel->got, (long)size); - if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { - RETURN(RC_WMORE); - } - } - /* * BIT STRING-specific processing. */ diff --git a/asn1/asn1c/constr_CHOICE.c b/asn1/asn1c/constr_CHOICE.c index 5a1e0d386..7c1b155ff 100644 --- a/asn1/asn1c/constr_CHOICE.c +++ b/asn1/asn1c/constr_CHOICE.c @@ -670,7 +670,6 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, case -1: ctx->phase = 5; RETURN(RC_FAIL); - continue; case 1: ctx->phase = 3; /* Fall through */ diff --git a/asn1/asn1c/der_encoder.c b/asn1/asn1c/der_encoder.c index 6c859e1b0..817dd6863 100644 --- a/asn1/asn1c/der_encoder.c +++ b/asn1/asn1c/der_encoder.c @@ -144,8 +144,8 @@ der_write_tags(asn_TYPE_descriptor_t *sd, if(!cb) return overall_length - struct_length; - ASN_DEBUG("%s %s TL sequence (%d elements)", - cb?"Encoding":"Estimating", sd->name, tags_count); + ASN_DEBUG("Encoding %s TL sequence (%d elements)", sd->name, + tags_count); /* * Encode the TL sequence for real. diff --git a/asn1/asn1c/per_support.c b/asn1/asn1c/per_support.c index 0d089f495..47f07bfb0 100644 --- a/asn1/asn1c/per_support.c +++ b/asn1/asn1c/per_support.c @@ -394,8 +394,8 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { buf[2] = bits >> 8, buf[3] = bits; else { - per_put_few_bits(po, bits >> (obits - 24), 24); - per_put_few_bits(po, bits, obits - 24); + if(per_put_few_bits(po, bits >> (obits - 24), 24)) return -1; + if(per_put_few_bits(po, bits, obits - 24)) return -1; } ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", -- cgit