diff options
author | tb <> | 2018-08-14 17:59:26 +0000 |
---|---|---|
committer | tb <> | 2018-08-14 17:59:26 +0000 |
commit | 064f9b1e7b63f56689f56c0c9bb54b684d63ada6 (patch) | |
tree | b7131f2cc53a9388e69ae3777929032251e5ffb2 | |
parent | 6f67f5587af65f7420834c04188f5ead57ab95f1 (diff) | |
download | openbsd-064f9b1e7b63f56689f56c0c9bb54b684d63ada6.tar.gz openbsd-064f9b1e7b63f56689f56c0c9bb54b684d63ada6.tar.bz2 openbsd-064f9b1e7b63f56689f56c0c9bb54b684d63ada6.zip |
Add a comment that explains what the check is doing and why len >= 1.
Prompted by a remark by jsing
-rw-r--r-- | src/lib/libcrypto/evp/evp_key.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c index debd1b7561..91d0fc0de9 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.25 2018/08/14 17:51:36 tb Exp $ */ | 1 | /* $OpenBSD: evp_key.c,v 1.26 2018/08/14 17:59:26 tb 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,6 +103,7 @@ EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, | |||
103 | 103 | ||
104 | if (len > BUFSIZ) | 104 | if (len > BUFSIZ) |
105 | len = BUFSIZ; | 105 | len = BUFSIZ; |
106 | /* Ensure that 0 <= min <= len - 1. In particular, 1 <= len. */ | ||
106 | if (min < 0 || len - 1 < min) | 107 | if (min < 0 || len - 1 < min) |
107 | return -1; | 108 | return -1; |
108 | if ((prompt == NULL) && (prompt_string[0] != '\0')) | 109 | if ((prompt == NULL) && (prompt_string[0] != '\0')) |