summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeck <>2015-10-14 21:02:08 +0000
committerbeck <>2015-10-14 21:02:08 +0000
commitb94124f8caf871e87767ee543513ae2e02968268 (patch)
tree1e4727f14becde549063eed9db6766a0e7728f7d
parent3ba95054095fc9c1ddfd504959be20825c352b45 (diff)
downloadopenbsd-b94124f8caf871e87767ee543513ae2e02968268.tar.gz
openbsd-b94124f8caf871e87767ee543513ae2e02968268.tar.bz2
openbsd-b94124f8caf871e87767ee543513ae2e02968268.zip
Ensure we don't write a 0 byte past end of the buffer in the error case.
ok bcook@ deraadt@
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c6
-rw-r--r--src/lib/libssl/src/crypto/objects/obj_dat.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
index 15c298e333..82ebb9b1d2 100644
--- a/src/lib/libcrypto/objects/obj_dat.c
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: obj_dat.c,v 1.31 2014/08/08 04:53:43 guenther Exp $ */ 1/* $OpenBSD: obj_dat.c,v 1.32 2015/10/14 21:02:08 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -574,7 +574,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
574 if (i == -1) 574 if (i == -1)
575 goto err; 575 goto err;
576 if (i >= buf_len) { 576 if (i >= buf_len) {
577 buf += buf_len; 577 buf += buf_len - 1;
578 buf_len = 0; 578 buf_len = 0;
579 } else { 579 } else {
580 buf += i; 580 buf += i;
@@ -586,7 +586,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
586 if (i == -1) 586 if (i == -1)
587 goto err; 587 goto err;
588 if (i >= buf_len) { 588 if (i >= buf_len) {
589 buf += buf_len; 589 buf += buf_len - 1;
590 buf_len = 0; 590 buf_len = 0;
591 } else { 591 } else {
592 buf += i; 592 buf += i;
diff --git a/src/lib/libssl/src/crypto/objects/obj_dat.c b/src/lib/libssl/src/crypto/objects/obj_dat.c
index 15c298e333..82ebb9b1d2 100644
--- a/src/lib/libssl/src/crypto/objects/obj_dat.c
+++ b/src/lib/libssl/src/crypto/objects/obj_dat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: obj_dat.c,v 1.31 2014/08/08 04:53:43 guenther Exp $ */ 1/* $OpenBSD: obj_dat.c,v 1.32 2015/10/14 21:02:08 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -574,7 +574,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
574 if (i == -1) 574 if (i == -1)
575 goto err; 575 goto err;
576 if (i >= buf_len) { 576 if (i >= buf_len) {
577 buf += buf_len; 577 buf += buf_len - 1;
578 buf_len = 0; 578 buf_len = 0;
579 } else { 579 } else {
580 buf += i; 580 buf += i;
@@ -586,7 +586,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
586 if (i == -1) 586 if (i == -1)
587 goto err; 587 goto err;
588 if (i >= buf_len) { 588 if (i >= buf_len) {
589 buf += buf_len; 589 buf += buf_len - 1;
590 buf_len = 0; 590 buf_len = 0;
591 } else { 591 } else {
592 buf += i; 592 buf += i;