Skip to content

Commit fbc4a97

Browse files
committed
gpg-interface: simplify ssh fingerprint parsing
In "gpg-interface.c", the 'parse_ssh_output()' function takes a 'struct signature_check *sigc' argument and populates many members of this 'sigc' using information parsed from 'sigc->output' which contains the ouput of an `ssh-keygen -Y ...` command that was used to verify an SSH signature. When it populates 'sigc->fingerprint' though, it uses `xstrdup(strstr(line, "key ") + 4)` while `strstr(line, "key ")` has already been computed a few lines above and is already available in the `key` variable. Let's simplify this. Signed-off-by: Christian Couder <[email protected]>
1 parent dc70283 commit fbc4a97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gpg-interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static void parse_ssh_output(struct signature_check *sigc)
443443

444444
key = strstr(line, "key ");
445445
if (key) {
446-
sigc->fingerprint = xstrdup(strstr(line, "key ") + 4);
446+
sigc->fingerprint = xstrdup(key + 4);
447447
sigc->key = xstrdup(sigc->fingerprint);
448448
} else {
449449
/*

0 commit comments

Comments
 (0)