⬢ DragonFlyBSD Kernel Audit
DF-2337 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/u4b/input/uep.c
+++ b/sys/bus/u4b/input/uep.c
@@ -223,6 +223,12 @@
 				goto tr_setup;
 
 			res = pkt_len - sc->buf_len;
+			if (res > len) {
+				/* short transfer: only len bytes arrived */
+				memcpy(sc->buf + sc->buf_len, buf, len);
+				sc->buf_len += len;
+				goto tr_setup;
+			}
 			memcpy(sc->buf + sc->buf_len, buf, res);
 			uep_process_pkt(sc, sc->buf);
 			sc->buf_len = 0;