summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar David Benjamin <davidben@mit.edu>2013-08-18 20:55:58 -0400
committerGravatar Karl Ramm <kcr@1ts.org>2013-09-28 13:45:17 -0400
commit5984f552acaf748228dec50e6dbc62d6c2fb0fe3 (patch)
tree4d1c9e8f61a3892933ee72700401817359a93b52
parentddd7fbceb82784e2fa91a5c963f7ddf607eda2b6 (diff)
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.
-rw-r--r--lib/Zinternal.c7
1 files 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) {