@@ -387,17 +387,19 @@ static void parse_ssh_output(struct signature_check *sigc)
387
387
line = to_free = xmemdupz (sigc -> output , strcspn (sigc -> output , "\n" ));
388
388
389
389
if (skip_prefix (line , "Good \"git\" signature for " , & line )) {
390
- /* Valid signature and known principal */
391
- sigc -> result = 'G' ;
392
- sigc -> trust_level = TRUST_FULLY ;
393
-
394
390
/* Search for the last "with" to get the full principal */
395
391
principal = line ;
396
392
do {
397
393
search = strstr (line , " with " );
398
394
if (search )
399
395
line = search + 1 ;
400
396
} while (search != NULL );
397
+ if (line == principal )
398
+ goto cleanup ;
399
+
400
+ /* Valid signature and known principal */
401
+ sigc -> result = 'G' ;
402
+ sigc -> trust_level = TRUST_FULLY ;
401
403
sigc -> signer = xmemdupz (principal , line - principal - 1 );
402
404
} else if (skip_prefix (line , "Good \"git\" signature with " , & line )) {
403
405
/* Valid signature, but key unknown */
@@ -407,9 +409,9 @@ static void parse_ssh_output(struct signature_check *sigc)
407
409
goto cleanup ;
408
410
}
409
411
410
- key = strstr (line , "key" );
412
+ key = strstr (line , "key " );
411
413
if (key ) {
412
- sigc -> fingerprint = xstrdup (strstr (line , "key" ) + 4 );
414
+ sigc -> fingerprint = xstrdup (strstr (line , "key " ) + 4 );
413
415
sigc -> key = xstrdup (sigc -> fingerprint );
414
416
} else {
415
417
/*
0 commit comments