diff options
author | tedu <> | 2015-10-14 21:54:10 +0000 |
---|---|---|
committer | tedu <> | 2015-10-14 21:54:10 +0000 |
commit | 7608b31f392fc1719d27258aafe319d9d2b39a81 (patch) | |
tree | b233835790f321df7fdc7c2cad0bac60900dfad6 | |
parent | 5a8717e330a264623a03842afe4db37c1f1d08a9 (diff) | |
download | openbsd-7608b31f392fc1719d27258aafe319d9d2b39a81.tar.gz openbsd-7608b31f392fc1719d27258aafe319d9d2b39a81.tar.bz2 openbsd-7608b31f392fc1719d27258aafe319d9d2b39a81.zip |
better fix for overrun reported by Qualys Security.
buf is at all times kept nul terminated, so there is no need to enforce
this again upon exit. (no need to move buf around after we exahust space.)
ok beck miod
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/objects/obj_dat.c | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index dd5d50122b..627f3230a7 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.34 2015/10/14 21:25:16 beck Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.35 2015/10/14 21:54:10 tedu 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 | * |
@@ -580,7 +580,6 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
580 | if (i == -1) | 580 | if (i == -1) |
581 | goto err; | 581 | goto err; |
582 | if (i >= buf_len) { | 582 | if (i >= buf_len) { |
583 | buf += buf_len - 1; | ||
584 | buf_len = 0; | 583 | buf_len = 0; |
585 | } else { | 584 | } else { |
586 | buf += i; | 585 | buf += i; |
@@ -592,7 +591,6 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
592 | if (i == -1) | 591 | if (i == -1) |
593 | goto err; | 592 | goto err; |
594 | if (i >= buf_len) { | 593 | if (i >= buf_len) { |
595 | buf += buf_len - 1; | ||
596 | buf_len = 0; | 594 | buf_len = 0; |
597 | } else { | 595 | } else { |
598 | buf += i; | 596 | buf += i; |
@@ -609,7 +607,6 @@ out: | |||
609 | 607 | ||
610 | err: | 608 | err: |
611 | ret = 0; | 609 | ret = 0; |
612 | buf[0] = '\0'; | ||
613 | goto out; | 610 | goto out; |
614 | } | 611 | } |
615 | 612 | ||
diff --git a/src/lib/libssl/src/crypto/objects/obj_dat.c b/src/lib/libssl/src/crypto/objects/obj_dat.c index dd5d50122b..627f3230a7 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.34 2015/10/14 21:25:16 beck Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.35 2015/10/14 21:54:10 tedu 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 | * |
@@ -580,7 +580,6 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
580 | if (i == -1) | 580 | if (i == -1) |
581 | goto err; | 581 | goto err; |
582 | if (i >= buf_len) { | 582 | if (i >= buf_len) { |
583 | buf += buf_len - 1; | ||
584 | buf_len = 0; | 583 | buf_len = 0; |
585 | } else { | 584 | } else { |
586 | buf += i; | 585 | buf += i; |
@@ -592,7 +591,6 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
592 | if (i == -1) | 591 | if (i == -1) |
593 | goto err; | 592 | goto err; |
594 | if (i >= buf_len) { | 593 | if (i >= buf_len) { |
595 | buf += buf_len - 1; | ||
596 | buf_len = 0; | 594 | buf_len = 0; |
597 | } else { | 595 | } else { |
598 | buf += i; | 596 | buf += i; |
@@ -609,7 +607,6 @@ out: | |||
609 | 607 | ||
610 | err: | 608 | err: |
611 | ret = 0; | 609 | ret = 0; |
612 | buf[0] = '\0'; | ||
613 | goto out; | 610 | goto out; |
614 | } | 611 | } |
615 | 612 | ||