diff options
Diffstat (limited to 'crypto/asn1/a_bitstr.c')
| -rw-r--r-- | crypto/asn1/a_bitstr.c | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c index f462dd107368..14b57265d172 100644 --- a/crypto/asn1/a_bitstr.c +++ b/crypto/asn1/a_bitstr.c @@ -1,5 +1,5 @@  /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.   *   * Licensed under the OpenSSL license (the "License").  You may not use   * this file except in compliance with the License.  You can obtain a copy @@ -148,6 +148,9 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)      int w, v, iv;      unsigned char *c; +    if (n < 0) +        return 0; +      w = n / 8;      v = 1 << (7 - (n & 0x07));      iv = ~v; @@ -182,6 +185,9 @@ int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n)  {      int w, v; +    if (n < 0) +        return 0; +      w = n / 8;      v = 1 << (7 - (n & 0x07));      if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) | 
