aboutsummaryrefslogtreecommitdiffstats
path: root/src/usb.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-09-01 09:36:04 +0200
committerHarald Welte <laforge@osmocom.org>2020-09-01 09:37:33 +0200
commit51e12ad60315c2447050ecf97a4a4894777a7fd1 (patch)
treebe2a89be4f36855cb011d96f03a59a12350e427c /src/usb.c
parent569726a72fd121481c9a52a49fe592e240c9e66c (diff)
usb: Don't pass negative length values to e1_line_demux_in()
every so often, the USB transfer completes without data (due to "unlucky" time alignment between E1 and USB frame clock). Don't call the demuxer in that case. Otherwise the user is confused by error messages like <0001> intf_line.c:467 (I0:L0) IN ERROR: -4 Change-Id: Ia99f97c2cca44d15a83a54cebe884b343ec44f46
Diffstat (limited to 'src/usb.c')
-rw-r--r--src/usb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/usb.c b/src/usb.c
index 7a5dce2..7f7f5c6 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -107,6 +107,8 @@ struct e1_usb_flow {
static int
e1_usb_xfer_in(struct e1_usb_flow *flow, uint8_t *buf, int size)
{
+ if (size == 0)
+ return 0;
return e1_line_demux_in(flow->line, buf + 4, size - 4);
}