From 0ce9fa2c88c8a534029cf435d5108d453acba3b3 Mon Sep 17 00:00:00 2001 From: beck Date: Wed, 14 Oct 2015 21:25:16 +0000 Subject: [PATCH] Bail out early if we have no buf_len ok miod@ --- lib/libcrypto/objects/obj_dat.c | 6 +++++- lib/libssl/src/crypto/objects/obj_dat.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index dab860d85c0..dd5d50122b9 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.33 2015/10/14 21:12:10 tedu Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.34 2015/10/14 21:25:16 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -565,6 +565,10 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) ret++; } + if (buf_len <= 0) { + ret = 0; + goto out; + } if (use_bn) { char *bndec; diff --git a/lib/libssl/src/crypto/objects/obj_dat.c b/lib/libssl/src/crypto/objects/obj_dat.c index dab860d85c0..dd5d50122b9 100644 --- a/lib/libssl/src/crypto/objects/obj_dat.c +++ b/lib/libssl/src/crypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.33 2015/10/14 21:12:10 tedu Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.34 2015/10/14 21:25:16 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -565,6 +565,10 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) ret++; } + if (buf_len <= 0) { + ret = 0; + goto out; + } if (use_bn) { char *bndec; -- 2.20.1