From 5984f552acaf748228dec50e6dbc62d6c2fb0fe3 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sun, 18 Aug 2013 20:55:58 -0400 Subject: Drop packets with garbage at the end on the floor This effectively reverts 170736db76139ed9fff9dbf70a55d4ba4f25d9bd. That commit didn't work anyway. It fails to update packet_len, so we computed the Z_InputQ's header_len wrong and fail to truncate the garbage anyway. Plus packets like that likely come from a broken cross-realm zephyrd without f276622ace757977fec43633e43577350e0cf6fe, so we want to drop them. That patch has yet to be in a released libzephyr, so if there are other sources of notices with trailing garbage, no one was relying on them working anyway. On the contrary, we were relying on them NOT working in that it masks broken cross-realm zephyrds. --- lib/Zinternal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Zinternal.c b/lib/Zinternal.c index 1f89df0..cc03c66 100644 --- a/lib/Zinternal.c +++ b/lib/Zinternal.c @@ -374,9 +374,12 @@ Z_ReadWait(void) if (partof > Z_MAXNOTICESIZE) return (ZERR_NONE); - /* Ignore garbage at the end */ + /* The packet has garbage at the end. This likely came from a cross-realm + * zephyrd without f276622ace757977fec43633e43577350e0cf6fe, which means + * it's retransmitting blindly anyway. Drop it on the floor. + */ if (notice.z_message_len > partof - part) - notice.z_message_len = partof - part; + return (ZERR_NONE); /* Pick the appropriate key to reassemble with. */ switch (notice.z_kind) { -- cgit v1.2.3