Fix OOB read in TS_OBJ_print_bio().
[openssl.git] / crypto / ts / ts_lib.c
index bde1bd75e47ed8beb8a552537ce716506b6da1ff..e18f1f3f7e3ff93b9d83dedfd5b5c3d35da3ff98 100644 (file)
@@ -40,9 +40,8 @@ int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)
 {
     char obj_txt[128];
 
-    int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
-    BIO_write(bio, obj_txt, len);
-    BIO_write(bio, "\n", 1);
+    OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
+    BIO_printf(bio, "%s\n", obj_txt);
 
     return 1;
 }