From: Hallvard Furuseth Date: Wed, 21 Oct 2009 12:41:34 +0000 (+0000) Subject: ITS#6344: return failure on failure in ber_put_ostring()/ber_put_bitstring() X-Git-Tag: ACLCHECK_0~177 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=068cf1c7019bb8ca1736f225501bf76474c109e1;p=openldap ITS#6344: return failure on failure in ber_put_ostring()/ber_put_bitstring() --- diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index a5c1de0286..d2a432fe1e 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -151,6 +151,7 @@ ber_encode_oid( BerValue *in, BerValue *out ) der[j] = tmp; } der += len; + if ( ptr == inend ) break; @@ -242,10 +243,10 @@ ber_put_ostring( rc = ber_write( ber, (char *) ptr, &header[sizeof(header)] - ptr, 0 ); if ( rc >= 0 && ber_write( ber, str, len, 0 ) >= 0 ) { /* length(tag + length + contents) */ - rc += (int) len; + return rc + (int) len; } - return rc; + return -1; } int @@ -300,10 +301,10 @@ ber_put_bitstring( rc = ber_write( ber, (char *) ptr, &header[sizeof(header)] - ptr, 0 ); if ( rc >= 0 && ber_write( ber, str, len, 0 ) >= 0 ) { /* length(tag + length + unused bit count + bitstring) */ - rc += (int) len; + return rc + (int) len; } - return rc; + return -1; } int