ASN1_BIT_STRING_set_bit() didn't clear previously set bits
[openssl.git] / crypto / asn1 / a_bitstr.c
index 46e97038a28c8fc9d072a6eb05e385f53c868e54..c36817c1ee4ca7c654604db50f74e3e481a77a44 100644 (file)
@@ -172,6 +172,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
        w=n/8;
        v=1<<(7-(n&0x07));
        iv= ~v;
+       if (!value) v=0;
 
        a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */