Explorar el 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 hace 5 años
padre
commit
e1c722b1b6
Se han modificado 1 ficheros con 3 adiciones y 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';