Skip to content

Commit 0ed26ac

Browse files
committed
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>
1 parent d0c4415 commit 0ed26ac

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: crypto/ts/ts_lib.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)
4040
{
4141
char obj_txt[128];
4242

43-
int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
44-
BIO_write(bio, obj_txt, len);
45-
BIO_write(bio, "\n", 1);
43+
OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
44+
BIO_printf(bio, "%s\n", obj_txt);
4645

4746
return 1;
4847
}

0 commit comments

Comments
 (0)