Index: kpw.d/kpw.c ================================================================== --- kpw.d/kpw.c +++ kpw.d/kpw.c @@ -692,11 +692,10 @@ if (strcmp(pw,pw_conf) != 0) return bad_pw_match; } acct_pw = pw; } else acct_pw = prm, pwlen = strlen(prm); - } else if (op == genpw) { unsigned long long len; if (prm != NULL) { alert(a_debug, "converting length parameter to integer"); bad e = katoi(10, prm, &len); @@ -709,10 +708,11 @@ if (print || !tty_out) { write(1, pw, len); if(tty_out) write(1, "\n", 1); } pwlen = len; + acct_pw = pw; } # ifdef _CLIPBOARD if (copy_pw) copy(pw, pwlen); # endif alert(a_debug, "encoding database entry"); @@ -720,11 +720,11 @@ byte plaintext[1 + acctlen + 1 + pwlen]; plaintext[0] = acctlen; strncpy(plaintext + 1, acct, acctlen); plaintext[1 + acctlen] = pwlen; - strncpy(plaintext + acctlen + 2, pw, pwlen); + strncpy(plaintext + acctlen + 2, acct_pw, pwlen); hexdump(plaintext, sz(plaintext)); alert(a_debug, "enciphering database entry"); byte ciphertext[sz(plaintext) + crypto_box_SEALBYTES];