From: Volker Lendecke Date: Tue, 21 Jul 2026 08:52:55 +0000 (+0200) Subject: lib: Simplify asn1_tag_remaining() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e349c7e2afd1af6481125ffbbbee780fe9d65c5;p=thirdparty%2Fsamba.git lib: Simplify asn1_tag_remaining() Introduce common error exit Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/lib/util/asn1.c b/lib/util/asn1.c index b6a54a09509..47dafc904b2 100644 --- a/lib/util/asn1.c +++ b/lib/util/asn1.c @@ -751,19 +751,19 @@ int asn1_tag_remaining(struct asn1_data *data) } if (!data->nesting) { - data->has_error = true; - return -1; + goto error; } remaining = data->nesting->taglen - (data->ofs - data->nesting->start); if (remaining > (data->length - data->ofs)) { - data->has_error = true; - return -1; + goto error; } if (remaining < 0) { - data->has_error = true; - return -1; + goto error; } return remaining; +error: + data->has_error = true; + return -1; } /**