diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-06-11 06:42:01 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-06-11 06:42:01 +0200 |
commit | 4e02db75e3a1da9012176f2cfe1638c8c0129f6f (patch) | |
tree | c6b79fea9648fce67a7f673c4b30d007a6b35616 /scd/app-openpgp.c | |
parent | po: Fix typo in Simplified Chinese Translation. (diff) | |
download | gnupg2-4e02db75e3a1da9012176f2cfe1638c8c0129f6f.tar.xz gnupg2-4e02db75e3a1da9012176f2cfe1638c8c0129f6f.zip |
scd: Support clearing of Reset Code by ''.
* scd/app-openpgp.c (do_change_pin): Allow null-string.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r-- | scd/app-openpgp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 39f1517f0..feea1905b 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -3477,7 +3477,9 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, } else if (set_resetcode) { - if (strlen (pinvalue) < 8) + size_t bufferlen = strlen (pinvalue); + + if (bufferlen != 0 && bufferlen < 8) { log_error (_("Reset Code is too short; minimum length is %d\n"), 8); rc = gpg_error (GPG_ERR_BAD_PIN); @@ -3485,7 +3487,6 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, else { char *buffer = NULL; - size_t bufferlen; rc = pin2hash_if_kdf (app, 0, pinvalue, &buffer, &bufferlen); if (!rc) |