Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/ipf/dist/tools #551 ipf.conf address structure ...



details:   https://anonhg.NetBSD.org/src/rev/14f07ae32e24
branches:  trunk
changeset: 796971:14f07ae32e24
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Sun Jun 29 08:53:08 2014 +0000

description:
#551 ipf.conf address structure not properly zero filled

diffstat:

 external/bsd/ipf/dist/tools/ipf_y.y |  34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)

diffs (106 lines):

diff -r 9503f6f66a1a -r 14f07ae32e24 external/bsd/ipf/dist/tools/ipf_y.y
--- a/external/bsd/ipf/dist/tools/ipf_y.y       Sun Jun 29 08:51:01 2014 +0000
+++ b/external/bsd/ipf/dist/tools/ipf_y.y       Sun Jun 29 08:53:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipf_y.y,v 1.2 2014/06/12 17:23:06 christos Exp $       */
+/*     $NetBSD: ipf_y.y,v 1.3 2014/06/29 08:53:08 darrenr Exp $        */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -1022,12 +1022,13 @@
                                          yyexpectaddr = 0; }
        ;
 
-ipaddr:        IPFY_ANY                        { bzero(&($$), sizeof($$));
+ipaddr:        IPFY_ANY                        { memset(&($$), 0, sizeof($$));
                                          $$.type = FRI_NORMAL;
                                          $$.ifpos = -1;
                                          yyexpectaddr = 0;
                                        }
-       | hostname                      { $$.a = $1.adr;
+       | hostname                      { memset(&($$), 0, sizeof($$));
+                                         $$.a = $1.adr;
                                          $$.f = $1.f;
                                          if ($1.f == AF_INET6)
                                                  fill6bits(128, $$.m.i6);
@@ -1040,7 +1041,8 @@
        | hostname                      { yyresetdict(); }
                maskspace               { yysetdict(maskwords);
                                          yyexpectaddr = 2; }
-               ipmask                  { ntomask($1.f, $5, $$.m.i6);
+               ipmask                  { memset(&($$), 0, sizeof($$));
+                                         ntomask($1.f, $5, $$.m.i6);
                                          $$.a = $1.adr;
                                          $$.a.i6[0] &= $$.m.i6[0];
                                          $$.a.i6[1] &= $$.m.i6[1];
@@ -1062,7 +1064,8 @@
                                          yyresetdict();
                                          yyexpectaddr = 0;
                                        }
-       | '(' YY_STR ')'                { $$.type = FRI_DYNAMIC;
+       | '(' YY_STR ')'                { memset(&($$), 0, sizeof($$));
+                                         $$.type = FRI_DYNAMIC;
                                          ifpflag = FRI_DYNAMIC;
                                          $$.ifpos = addname(&fr, $2);
                                          $$.lif = 0;
@@ -1070,7 +1073,8 @@
        | '(' YY_STR ')' '/'
          { ifpflag = FRI_DYNAMIC; yysetdict(maskwords); }
          maskopts
-                                       { $$.type = ifpflag;
+                                       { memset(&($$), 0, sizeof($$));
+                                         $$.type = ifpflag;
                                          $$.ifpos = addname(&fr, $2);
                                          $$.lif = 0;
                                          if (frc->fr_family == AF_UNSPEC)
@@ -1085,7 +1089,8 @@
        | '(' YY_STR ':' YY_NUMBER ')' '/'
          { ifpflag = FRI_DYNAMIC; yysetdict(maskwords); }
          maskopts
-                                       { $$.type = ifpflag;
+                                       { memset(&($$), 0, sizeof($$));
+                                         $$.type = ifpflag;
                                          $$.ifpos = addname(&fr, $2);
                                          $$.lif = $4;
                                          if (frc->fr_family == AF_UNSPEC)
@@ -1144,30 +1149,35 @@
        ;
 
 hostname:
-       ipv4                            { $$.adr.in4 = $1;
+       ipv4                            { memset(&($$), 0, sizeof($$));
+                                         $$.adr.in4 = $1;
                                          if (frc->fr_family == AF_INET6)
                                                YYERROR;
                                          $$.f = AF_INET;
                                          yyexpectaddr = 2;
                                        }
-       | YY_NUMBER                     { if (frc->fr_family == AF_INET6)
+       | YY_NUMBER                     { memset(&($$), 0, sizeof($$));
+                                         if (frc->fr_family == AF_INET6)
                                                YYERROR;
                                          $$.adr.in4_addr = $1;
                                          $$.f = AF_INET;
                                          yyexpectaddr = 2;
                                        }
-       | YY_HEX                        { if (frc->fr_family == AF_INET6)
+       | YY_HEX                        { memset(&($$), 0, sizeof($$));
+                                         if (frc->fr_family == AF_INET6)
                                                YYERROR;
                                          $$.adr.in4_addr = $1;
                                          $$.f = AF_INET;
                                          yyexpectaddr = 2;
                                        }
-       | YY_STR                        { if (lookuphost($1, &$$.adr) == 0)
+       | YY_STR                        { memset(&($$), 0, sizeof($$));
+                                         if (lookuphost($1, &$$.adr) == 0)
                                                  $$.f = AF_INET;
                                          free($1);
                                          yyexpectaddr = 2;
                                        }
-       | YY_IPV6                       { if (frc->fr_family == AF_INET)
+       | YY_IPV6                       { memset(&($$), 0, sizeof($$));
+                                         if (frc->fr_family == AF_INET)
                                                YYERROR;
                                          $$.adr = $1;
                                          $$.f = AF_INET6;



Home | Main Index | Thread Index | Old Index