File openssl-CVE-2016-2180.patch of Package openssl.4105

commit 6adf409c7432b90c06d9890787fe56c48f2a16e7
Author: Dr. Stephen Henson <steve@openssl.org>
Date:   Thu Jul 21 15:24:16 2016 +0100

    Fix OOB read in TS_OBJ_print_bio().
    
    TS_OBJ_print_bio() misuses OBJ_txt2obj: it should print the result
    as a null terminated buffer. The length value returned is the total
    length the complete text reprsentation would need not the amount of
    data written.
    
    CVE-2016-2180
    
    Thanks to Shi Lei for reporting this bug.
    
    Reviewed-by: Matt Caswell <matt@openssl.org>
    (cherry picked from commit 0ed26acce328ec16a3aa635f1ca37365e8c7403a)

Index: openssl-1.0.1i/crypto/ts/ts_lib.c
===================================================================
--- openssl-1.0.1i.orig/crypto/ts/ts_lib.c	2016-08-08 14:34:04.376461214 +0200
+++ openssl-1.0.1i/crypto/ts/ts_lib.c	2016-08-08 14:37:36.080067696 +0200
@@ -90,9 +90,8 @@ int TS_OBJ_print_bio(BIO *bio, const ASN
 	{
 	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;
 	}
openSUSE Build Service is sponsored by