Explorar o código

be more tolerant when reading key fingerprint

usign occasionally writes 16 characters then exits without writing a LF,
leaving ucert hanging waiting for more input.  Accept 16 characters
or more rather than 17 to work around the short read.

Signed-off-by: Mike McCormack <mike@atratus.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Daniel Golle %!s(int64=5) %!d(string=hai) anos
pai
achega
e1c722b1b6
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      usign-exec.c

+ 3 - 2
usign-exec.c

@@ -156,9 +156,10 @@ static int usign_f(char *fingerprint, const char *pubkeyfile, const char *seckey
 		waitpid(pid, &status, 0);
 		status = WEXITSTATUS(status);
 		if (fingerprint && !WEXITSTATUS(status)) {
+			ssize_t r;
 			memset(fingerprint, 0, 17);
-			read(fds[0], fingerprint, 17);
-			if (fingerprint[16] != '\n')
+			r = read(fds[0], fingerprint, 17);
+			if (r < 16)
 				status = -1;
 
 			fingerprint[16] = '\0';