diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2018-08-14 17:59:27 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2018-08-14 17:59:27 +0000 |
commit | 5b3dcf844aa7211d6323510ef13487e744620969 (patch) | |
tree | 54443ecd82947f21cdcf98b99430f8e9453420d9 /lib | |
parent | 4c6a6bba0ba56d5d3a1b25f740b783df631aeb80 (diff) |
Add a comment that explains what the check is doing and why len >= 1.
Prompted by a remark by jsing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/evp/evp_key.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libcrypto/evp/evp_key.c b/lib/libcrypto/evp/evp_key.c index debd1b75610..91d0fc0de97 100644 --- a/lib/libcrypto/evp/evp_key.c +++ b/lib/libcrypto/evp/evp_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_key.c,v 1.25 2018/08/14 17:51:36 tb Exp $ */ +/* $OpenBSD: evp_key.c,v 1.26 2018/08/14 17:59:26 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -103,6 +103,7 @@ EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, if (len > BUFSIZ) len = BUFSIZ; + /* Ensure that 0 <= min <= len - 1. In particular, 1 <= len. */ if (min < 0 || len - 1 < min) return -1; if ((prompt == NULL) && (prompt_string[0] != '\0')) |