util  Diff

Differences From Artifact [6b73e83d39]:

To Artifact [bd775cdba4]:


     4      4    *  © AGPLv3
     5      5    *  $ cc -O4 kpw.c -okpw [-D_CLIPBOARD]
     6      6    *    - D_CLIPBOARD enables kpw to automatically
     7      7    *      copy passwords to the clipboard. it does
     8      8    *      this by attempting to execute a sequence
     9      9    *      of binaries, and then writing the password
    10     10    *      to STDIN of the binary that succeeds.
           11  + *    - D_SAVEKEY enables kpw to store the database
           12  + *      key in persistent memory between invocations,
           13  + *      leading to quicker decryption and access
           14  + *      times. only available on systems with SYSV
           15  + *      shared memory.
    11     16    *  ? generates passwords
    12     17    *  → kpw is unlikely to be portable to non-POSIX
    13     18    *    systems, but should run fine on Linux as well
    14     19    *    as BSDs with getrandom() support.
    15     20    *  → kpw has the following dependencies:
    16     21    *    - libsodium
    17     22    *  ! for getrandom() to work with the version of
................................................................................
   807    812   				     ptbuf [ptlen];
   808    813   				struct dbrecord rec;
   809    814   
   810    815   				bad d;
   811    816   				if((d = dbnext(db, &rec, ctlen,
   812    817   					pub, priv, ctbuf, ptbuf)) != ok) return d;
   813    818   
   814         -				if(strncmp(target, rec.acct.ptr, rec.acct.len) == 0) {
          819  +				if(strlen(target) == rec.acct.len && strncmp(target, rec.acct.ptr, rec.acct.len) == 0) {
   815    820   					/* found a matching record; determine
   816    821   					 * what to do to the fucker */
   817    822   					alert(a_debug, "found target record");
   818    823   					found = true;
   819    824   					if (op == delpw) continue;
   820    825   
   821    826   					password pwbuf;