Skip to contentSkip to conversation

slirp: Prevent sending ICMP error replies to source-only addresses

PATCH New Jan Kiszka 1 participant 1 message Feb 8, 2012

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 slirp: Prevent sending ICMP error replies to source-only addresses

This triggered the related assert in arp_table_search.

---
 slirp/ip_icmp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
slirp/ip_icmp.c +5 -0
index 4b43994..5dbf21d 100644
@@ -262,6 +262,11 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
 #endif
   if(ip->ip_off & IP_OFFMASK) goto end_error;    /* Only reply to fragment 0 */
 
+  /* Do not reply to source-only IPs */
+  if ((ip->ip_src.s_addr & htonl(~(0xf << 28))) == 0) {
+      goto end_error;
+  }
+
   shlen=ip->ip_hl << 2;
   s_ip_len=ip->ip_len;
   if(ip->ip_p == IPPROTO_ICMP) {
Signature · 1 line
1.7.3.4