summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiod <>2014-07-23 04:44:56 +0000
committermiod <>2014-07-23 04:44:56 +0000
commit9074b79d6e18e3a9e5873241dfd82982ce5a3ac1 (patch)
tree7ca3a5b6920123054f976628e8fd8363f64000be
parente1bad9c63c8b2d0daeb63fd3ce71f1c5aca163a2 (diff)
downloadopenbsd-9074b79d6e18e3a9e5873241dfd82982ce5a3ac1.tar.gz
openbsd-9074b79d6e18e3a9e5873241dfd82982ce5a3ac1.tar.bz2
openbsd-9074b79d6e18e3a9e5873241dfd82982ce5a3ac1.zip
Check the return value of the UI functions (including UI_new() which return
value is happily dereferenced without checking it for being non-NULL). ok beck@
-rw-r--r--src/lib/libcrypto/evp/evp_key.c17
-rw-r--r--src/lib/libssl/src/crypto/evp/evp_key.c17
2 files changed, 22 insertions, 12 deletions
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index dffca300c6..2873a888bd 100644
--- a/src/lib/libcrypto/evp/evp_key.c
+++ b/src/lib/libcrypto/evp/evp_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_key.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: evp_key.c,v 1.19 2014/07/23 04:44:56 miod 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 *
@@ -103,11 +103,16 @@ EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
103 if ((prompt == NULL) && (prompt_string[0] != '\0')) 103 if ((prompt == NULL) && (prompt_string[0] != '\0'))
104 prompt = prompt_string; 104 prompt = prompt_string;
105 ui = UI_new(); 105 ui = UI_new();
106 UI_add_input_string(ui, prompt, 0, buf, min, 106 if (ui == NULL)
107 (len >= BUFSIZ) ? BUFSIZ - 1 : len); 107 return -1;
108 if (verify) 108 if (UI_add_input_string(ui, prompt, 0, buf, min,
109 UI_add_verify_string(ui, prompt, 0, buff, min, 109 (len >= BUFSIZ) ? BUFSIZ - 1 : len) != 0)
110 (len >= BUFSIZ) ? BUFSIZ - 1 : len, buf); 110 return -1;
111 if (verify) {
112 if (UI_add_verify_string(ui, prompt, 0, buff, min,
113 (len >= BUFSIZ) ? BUFSIZ - 1 : len, buf) != 0)
114 return -1;
115 }
111 ret = UI_process(ui); 116 ret = UI_process(ui);
112 UI_free(ui); 117 UI_free(ui);
113 OPENSSL_cleanse(buff, BUFSIZ); 118 OPENSSL_cleanse(buff, BUFSIZ);
diff --git a/src/lib/libssl/src/crypto/evp/evp_key.c b/src/lib/libssl/src/crypto/evp/evp_key.c
index dffca300c6..2873a888bd 100644
--- a/src/lib/libssl/src/crypto/evp/evp_key.c
+++ b/src/lib/libssl/src/crypto/evp/evp_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_key.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: evp_key.c,v 1.19 2014/07/23 04:44:56 miod 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 *
@@ -103,11 +103,16 @@ EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
103 if ((prompt == NULL) && (prompt_string[0] != '\0')) 103 if ((prompt == NULL) && (prompt_string[0] != '\0'))
104 prompt = prompt_string; 104 prompt = prompt_string;
105 ui = UI_new(); 105 ui = UI_new();
106 UI_add_input_string(ui, prompt, 0, buf, min, 106 if (ui == NULL)
107 (len >= BUFSIZ) ? BUFSIZ - 1 : len); 107 return -1;
108 if (verify) 108 if (UI_add_input_string(ui, prompt, 0, buf, min,
109 UI_add_verify_string(ui, prompt, 0, buff, min, 109 (len >= BUFSIZ) ? BUFSIZ - 1 : len) != 0)
110 (len >= BUFSIZ) ? BUFSIZ - 1 : len, buf); 110 return -1;
111 if (verify) {
112 if (UI_add_verify_string(ui, prompt, 0, buff, min,
113 (len >= BUFSIZ) ? BUFSIZ - 1 : len, buf) != 0)
114 return -1;
115 }
111 ret = UI_process(ui); 116 ret = UI_process(ui);
112 UI_free(ui); 117 UI_free(ui);
113 OPENSSL_cleanse(buff, BUFSIZ); 118 OPENSSL_cleanse(buff, BUFSIZ);