summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/icmp6.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/icmp6.c')
-rw-r--r--sys/netinet6/icmp6.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 4ea9a3a..2b2f6ea 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1539,8 +1539,12 @@ ni6_nametodns(name, namelen, old)
/* result does not fit into mbuf */
if (cp + i + 1 >= ep)
goto fail;
- /* DNS label length restriction, RFC1035 page 8 */
- if (i >= 64)
+ /*
+ * DNS label length restriction, RFC1035 page 8.
+ * "i == 0" case is included here to avoid returning
+ * 0-length label on "foo..bar".
+ */
+ if (i <= 0 || i >= 64)
goto fail;
*cp++ = i;
bcopy(p, cp, i);
OpenPOWER on IntegriCloud