util  Diff

Differences From Artifact [baa5c21b20]:

To Artifact [e965fe4be4]:


   690    690   						e = pwread(true, pw_conf, NULL, _str("- confirm: "));
   691    691   						if (e != ok) return e;
   692    692   						if (strcmp(pw,pw_conf) != 0)
   693    693   							return bad_pw_match;
   694    694   					}
   695    695   					acct_pw = pw;
   696    696   				} else acct_pw = prm, pwlen = strlen(prm);
   697         -
   698    697   			} else if (op == genpw) {
   699    698   				unsigned long long len; 
   700    699   				if (prm != NULL) {
   701    700   					alert(a_debug, "converting length parameter to integer");
   702    701   					bad e = katoi(10, prm, &len);
   703    702   					if (e != ok) return bad_num;
   704    703   				} else alert(a_debug, "using default password length"),
................................................................................
   707    706   				alert(a_debug, "generating new password");
   708    707   				if (mkpw(mode, pw, len) == bad_entropy) return bad_entropy;
   709    708   				if (print || !tty_out) {
   710    709   					write(1, pw, len);
   711    710   					if(tty_out) write(1, "\n", 1);
   712    711   				}
   713    712   				pwlen = len;
          713  +				acct_pw = pw;
   714    714   			}
   715    715   #			ifdef _CLIPBOARD
   716    716   				if (copy_pw) copy(pw, pwlen);
   717    717   #			endif
   718    718   			alert(a_debug, "encoding database entry");
   719    719   			db_sz acctlen = strlen(acct);
   720    720   			byte plaintext[1 + acctlen +
   721    721   			               1 + pwlen];
   722    722   			plaintext[0] = acctlen;
   723    723   			strncpy(plaintext + 1, acct, acctlen);
   724    724   			plaintext[1 + acctlen] = pwlen;
   725         -			strncpy(plaintext + acctlen + 2, pw, pwlen);
          725  +			strncpy(plaintext + acctlen + 2, acct_pw, pwlen);
   726    726   			hexdump(plaintext, sz(plaintext));
   727    727   
   728    728   			alert(a_debug, "enciphering database entry");
   729    729   
   730    730   			byte ciphertext[sz(plaintext) + crypto_box_SEALBYTES];
   731    731   			crypto_box_seal(ciphertext, plaintext, sz(plaintext), key);
   732    732   			hexdump(ciphertext, sz(ciphertext));