On Wed, Mar 21, 2018 at 5:50 PM, Keith Mendoza <panthe...@gmail.com> wrote:
Hi,
> I'm one of the volunteer developers with ICEI (please see email with
> subject "ICEI asks what help you need" for details). I was attempting
> to compile net-snmp code with -std=c99 compiler option, and the
> compiler failed with "error: overflow in implicit constant conversion
> [-Werror=overflow] on the following lines in
> net-snmp-code/agent/mibII/vacm_vars.c: 382, 397, and 593. These 3
> locations have *cp++ = 255;
>
> So, my question is where can I get more information on
> var_vacm_access(). It appears to me it has something to do with
> determining group access control for a MIB group. Specifically, what
> is the rational for incrementing, then basically setting the location
> pointed by "cp" to 255 given the if logic above each of the 3
> locations where *cp++ = 255 is set.
>
Keith,
The blocks in question look like
oid *op;
char *cp;
...
cp = contextPrefix;
for (i = 0; i <= len && op < name + *length; i++) {
if (*op > 255) {
*cp++ = 255;
++op;
} else
*cp++ = (char) *op++;
}
The underlying type of oid is int or long, so it becomes obvious that this
code is copying values from op to cp while truncating values that won’t fit
into a char.
It’s probably not unreasonable to change the relevant types to u_char.
Bill
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders