diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-07-21 15:24:16 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-07-22 15:16:31 +0100 |
commit | b746aa3fe05b5b5f7126df247ac3eceeb995e2a0 (patch) | |
tree | 30a46a6697f5c23a896dfbf0376afd9c92833cd8 /crypto/ts | |
parent | b880283683958c873ce8363892c44277ec5081f8 (diff) |
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)
Diffstat (limited to 'crypto/ts')
-rw-r--r-- | crypto/ts/ts_lib.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/ts/ts_lib.c b/crypto/ts/ts_lib.c index c51538a17f..e0f1063537 100644 --- a/crypto/ts/ts_lib.c +++ b/crypto/ts/ts_lib.c @@ -90,9 +90,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; } |