The code generated by the mfd template does not correctly calculate the length
of a bits field when all the bits between a byte boundary are 0, but a later
byte does have some bits set (eg 0x8f008e). This patch fixes the code template.

There is no code in any net-snmp module that has this incorrectly generated
code, so this patch is 100% safe.

Index: local/mib2c-conf.d/mfd-interface.m2c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/local/mib2c-conf.d/mfd-interface.m2c,v
retrieving revision 1.71
diff -u -p -r1.71 mfd-interface.m2c
--- local/mib2c-conf.d/mfd-interface.m2c        7 Sep 2006 16:29:55 -0000       
1.71
+++ local/mib2c-conf.d/mfd-interface.m2c        27 Oct 2006 14:23:11 -0000
@@ -850,7 +850,8 @@ _${context}_get_column( ${context}_rowre
 @         if $m2c_node_needlength == 0@
 @            if "$node.perltype" eq "BITS"@
     {
-        $m2c_decl tmp = 0xff << ((sizeof($m2c_decl) - 1) * 8);
+        $m2c_decl mask = 0xff << ((sizeof($m2c_decl) - 1) * 8);
+        int       idx = 0;
 @            else@
     var->val_len = sizeof($m2c_decl);
 @            end@
@@ -862,10 +863,11 @@ rc = ${node}_get(rowreq_ctx, $m2c_node_v
          * check for length of bits string
          */
         var->val_len = 0;
-        while( 0 != tmp ) {
-            if ( *(($m2c_decl *) var->val.string) & tmp )
-                ++var->val_len;
-            tmp = tmp >> 8;
+        while( 0 != mask ) {
+            ++idx;
+            if ( *(($m2c_decl *) var->val.string) & mask )
+                var->val_len = idx;
+            mask = mask >> 8;
         }
     }
 @         end@

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to