In BIO_write(), update the write statistics, not the read statistics.
[oweals/openssl.git] / crypto / asn1 / a_object.c
index 0fbc368f0db569ec3a051ad4603007db439872b0..dc980421d098bb2d641ca15b8cf55dfafb6dbc4d 100644 (file)
@@ -62,6 +62,7 @@
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
+#include <openssl/bn.h>
 
 int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
        {
@@ -246,6 +247,8 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
                        return -1;
                i2t_ASN1_OBJECT(p,i + 1,a);
                }
+       if (i <= 0)
+               return BIO_write(bp, "<INVALID>", 9);
        BIO_write(bp,p,i);
        if (p != buf)
                OPENSSL_free(p);