Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/netinet6 Pull up revision 1.76 (requested by itojun):



details:   https://anonhg.NetBSD.org/src/rev/2fd043be5ca7
branches:  netbsd-1-6
changeset: 527565:2fd043be5ca7
user:      tv <tv%NetBSD.org@localhost>
date:      Tue May 28 19:24:57 2002 +0000

description:
Pull up revision 1.76 (requested by itojun):
make a strict check before sending FQDN node information reply.  sync w/kame

diffstat:

 sys/netinet6/icmp6.c |  22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r e720360248f9 -r 2fd043be5ca7 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Tue May 28 11:22:37 2002 +0000
+++ b/sys/netinet6/icmp6.c      Tue May 28 19:24:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.75 2002/03/05 08:13:56 itojun Exp $        */
+/*     $NetBSD: icmp6.c,v 1.75.8.1 2002/05/28 19:24:57 tv Exp $        */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.75 2002/03/05 08:13:56 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.75.8.1 2002/05/28 19:24:57 tv Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1540,6 +1540,11 @@
 }
 #undef hostnamelen
 
+#define isupper(x) ('A' <= (x) && (x) <= 'Z')
+#define isalpha(x) (('A' <= (x) && (x) <= 'Z') || ('a' <= (x) && (x) <= 'z'))
+#define isalnum(x) (isalpha(x) || ('0' <= (x) && (x) <= '9'))
+#define tolower(x) (isupper(x) ? (x) + 'a' - 'A' : (x))
+
 /*
  * make a mbuf with DNS-encoded string.  no compression support.
  *
@@ -1617,8 +1622,17 @@
                        if (i <= 0 || i >= 64)
                                goto fail;
                        *cp++ = i;
-                       bcopy(p, cp, i);
-                       cp += i;
+                       if (!isalpha(p[0]) || !isalnum(p[i - 1]))
+                               goto fail;
+                       while (i > 0) {
+                               if (!isalnum(*p) && *p != '-')
+                                       goto fail;
+                               if (isupper(*p))
+                                       *cp++ = tolower(*p++);
+                               else
+                                       *cp++ = *p++;
+                               i--;
+                       }
                        p = q;
                        if (p < name + namelen && *p == '.')
                                p++;



Home | Main Index | Thread Index | Old Index