summaryrefslogtreecommitdiffstats
path: root/scd/app-openpgp.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-06-11 06:42:01 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2021-06-11 06:42:01 +0200
commit4e02db75e3a1da9012176f2cfe1638c8c0129f6f (patch)
treec6b79fea9648fce67a7f673c4b30d007a6b35616 /scd/app-openpgp.c
parentpo: Fix typo in Simplified Chinese Translation. (diff)
downloadgnupg2-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.c5
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)