summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/objects/obj_dat.c
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2015-10-14 21:02:08 +0000
committerbeck <beck@openbsd.org>2015-10-14 21:02:08 +0000
commit8984dfbc963f52e9d49146ebd1d82a032b2b138d (patch)
tree3b16532ea593b439d603f5e5be916584ef8925fd /lib/libcrypto/objects/obj_dat.c
parentUse a strict $PATH of "/usr/bin:/usr/local/bin" to run the (de)compressors (diff)
downloadwireguard-openbsd-8984dfbc963f52e9d49146ebd1d82a032b2b138d.tar.xz
wireguard-openbsd-8984dfbc963f52e9d49146ebd1d82a032b2b138d.zip
Ensure we don't write a 0 byte past end of the buffer in the error case.
ok bcook@ deraadt@
Diffstat (limited to 'lib/libcrypto/objects/obj_dat.c')
-rw-r--r--lib/libcrypto/objects/obj_dat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c
index 15c298e3330..82ebb9b1d20 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.31 2014/08/08 04:53:43 guenther Exp $ */
+/* $OpenBSD: obj_dat.c,v 1.32 2015/10/14 21:02:08 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -574,7 +574,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
if (i == -1)
goto err;
if (i >= buf_len) {
- buf += buf_len;
+ buf += buf_len - 1;
buf_len = 0;
} else {
buf += i;
@@ -586,7 +586,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
if (i == -1)
goto err;
if (i >= buf_len) {
- buf += buf_len;
+ buf += buf_len - 1;
buf_len = 0;
} else {
buf += i;