[PATCH] ucert: Add patch to workaround short read

Mike McCormack mike at atratus.org
Sat Aug 18 02:04:57 EDT 2018


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 at atratus.org>
---
 package/system/ucert/patches/0001-Fix-cert-length.patch | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 package/system/ucert/patches/0001-Fix-cert-length.patch

diff --git a/package/system/ucert/patches/0001-Fix-cert-length.patch b/package/system/ucert/patches/0001-Fix-cert-length.patch
new file mode 100644
index 0000000000..8ccf4561fb
--- /dev/null
+++ b/package/system/ucert/patches/0001-Fix-cert-length.patch
@@ -0,0 +1,15 @@
+--- a/usign-exec.c	2018-08-09 03:48:11.000000000 +1000
++++ b/usign-exec.c	2018-08-18 16:03:41.393546235 +1000
+@@ -156,9 +156,10 @@
+ 		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';
-- 
2.11.0


--------------6882FA0889E94787844F4BEC
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

--------------6882FA0889E94787844F4BEC--




More information about the openwrt-devel mailing list