The following reply was made to PR kern/107565; it has been noted by GNATS.

From: "Anishchuk, Igor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>,
        "Anishchuk, Igor" <[EMAIL PROTECTED]>
Cc:  
Subject: Re: kern/107565: [ipfw] [patch] input string parsing mistake
Date: Fri, 5 Jan 2007 22:36:40 +0200

 Hello!
 
 I've found a little mistake in my workaround. The line
    for(ti=3D0; ti<16 && p[ti] !=3D 0; ti++){
 should be
    for (ti=3D0; ti<16 && p && p[ti] !=3D 0; ti++){
 
 Please change is ASAP otherwise segmentation fault will happen in some
 conditions.
 
 The complete, tested patch is:
 
 --- /usr/src/sbin/ipfw/ipfw2.c  Fri Jan  5 17:43:25 2007
 ***************
 *** 2720,2725 ****
 --- 2720,2733 ----
         char *p =3D strpbrk(av, "/:,{");
         int masklen;
         char md;
 +         char t[15];
 +         int ti;
 +
 +         for (ti=3D0; ti<16 && p && p[ti] !=3D 0; ti++){
 +                 t[ti]=3Dp[ti+1];
 +                 if(t[ti] !=3D '.' && (t[ti] < '0' || t[ti] > '9'))
 +                         t[ti] =3D '\0';
 +         }
 
         if (p) {
                 md =3D *p;
 ***************
 *** 2731,2741 ****
                 errx(EX_NOHOST, "hostname ``%s'' unknown", av);
         switch (md) {
         case ':':
 !               if (!inet_aton(p, (struct in_addr *)&d[1]))
                         errx(EX_DATAERR, "bad netmask ``%s''", p);
                 break;
         case '/':
 !               masklen =3D atoi(p);
                 if (masklen =3D=3D 0)
                         d[1] =3D htonl(0);        /* mask */
                 else if (masklen > 32)
 --- 2739,2749 ----
                 errx(EX_NOHOST, "hostname ``%s'' unknown", av);
         switch (md) {
         case ':':
 !               if (!inet_aton(t, (struct in_addr *)&d[1]))
                         errx(EX_DATAERR, "bad netmask ``%s''", p);
                 break;
         case '/':
 !               masklen =3D atoi(t);
                 if (masklen =3D=3D 0)
                         d[1] =3D htonl(0);        /* mask */
                 else if (masklen > 32)
 
 Thanks!
 
 --=20
 Igor Anishchuk
_______________________________________________
freebsd-ipfw@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ipfw
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to