diff options
author | jsing <> | 2017-02-07 15:52:33 +0000 |
---|---|---|
committer | jsing <> | 2017-02-07 15:52:33 +0000 |
commit | 7015be7e487c936fda9b4981ba162c0cc1b837de (patch) | |
tree | 5611c369cbc77a0009ce9318c87b57af9abd270b /src | |
parent | bbfdffb50bf4df747d39e4d05c8f038d2a575ef9 (diff) | |
download | openbsd-7015be7e487c936fda9b4981ba162c0cc1b837de.tar.gz openbsd-7015be7e487c936fda9b4981ba162c0cc1b837de.tar.bz2 openbsd-7015be7e487c936fda9b4981ba162c0cc1b837de.zip |
Revert previous; the implementation is incorrect since it assumes that the
provided error code matches the error that is currently on the top of the
error stack.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/err/err.c | 21 | ||||
-rw-r--r-- | src/lib/libcrypto/err/err_prn.c | 6 |
2 files changed, 7 insertions, 20 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index dcf725fd64..1b235c1653 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err.c,v 1.43 2017/02/07 03:11:11 beck Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.44 2017/02/07 15:52:33 jsing 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 | * |
@@ -862,9 +862,8 @@ void | |||
862 | ERR_error_string_n(unsigned long e, char *buf, size_t len) | 862 | ERR_error_string_n(unsigned long e, char *buf, size_t len) |
863 | { | 863 | { |
864 | char lsbuf[30], fsbuf[30], rsbuf[30]; | 864 | char lsbuf[30], fsbuf[30], rsbuf[30]; |
865 | const char *ls, *fs, *rs, *file, *data; | 865 | const char *ls, *fs, *rs; |
866 | int l, f, r, ret, line, flags; | 866 | int l, f, r, ret; |
867 | |||
868 | 867 | ||
869 | l = ERR_GET_LIB(e); | 868 | l = ERR_GET_LIB(e); |
870 | f = ERR_GET_FUNC(e); | 869 | f = ERR_GET_FUNC(e); |
@@ -887,19 +886,7 @@ ERR_error_string_n(unsigned long e, char *buf, size_t len) | |||
887 | rs = rsbuf; | 886 | rs = rsbuf; |
888 | } | 887 | } |
889 | 888 | ||
890 | if (ERR_get_error_line_data(&file, &line, &data, &flags) != 0) { | 889 | ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs); |
891 | const char *filename; | ||
892 | |||
893 | if ((filename = strrchr(file, '/')) != NULL) | ||
894 | filename++; | ||
895 | else | ||
896 | filename = file; | ||
897 | |||
898 | ret = snprintf(buf, len, "error:%08lX:%s:%s:%s:%s:%d", e, ls, | ||
899 | fs, rs, filename, line); | ||
900 | } else | ||
901 | ret = snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs); | ||
902 | |||
903 | if (ret == -1) | 890 | if (ret == -1) |
904 | return; /* can't happen, and can't do better if it does */ | 891 | return; /* can't happen, and can't do better if it does */ |
905 | if (ret >= len) { | 892 | if (ret >= len) { |
diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c index 6a3062a89a..48166829d4 100644 --- a/src/lib/libcrypto/err/err_prn.c +++ b/src/lib/libcrypto/err/err_prn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err_prn.c,v 1.17 2017/02/07 03:11:11 beck Exp $ */ | 1 | /* $OpenBSD: err_prn.c,v 1.18 2017/02/07 15:52:33 jsing 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 | * |
@@ -80,8 +80,8 @@ ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u) | |||
80 | while ((l = ERR_get_error_line_data(&file, &line, &data, | 80 | while ((l = ERR_get_error_line_data(&file, &line, &data, |
81 | &flags)) != 0) { | 81 | &flags)) != 0) { |
82 | ERR_error_string_n(l, buf, sizeof buf); | 82 | ERR_error_string_n(l, buf, sizeof buf); |
83 | (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s\n", es, | 83 | (void) snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, |
84 | buf, (flags & ERR_TXT_STRING) ? data : ""); | 84 | buf, file, line, (flags & ERR_TXT_STRING) ? data : ""); |
85 | if (cb(buf2, strlen(buf2), u) <= 0) | 85 | if (cb(buf2, strlen(buf2), u) <= 0) |
86 | break; /* abort outputting the error report */ | 86 | break; /* abort outputting the error report */ |
87 | } | 87 | } |