On Fri, 28 Jul 2017 12:39:48 +0000 Florian Obser <flor...@openbsd.org> wrote:
> Not sure about this one, a quick glance at RFC 3411 suggests this
> is just a binary string, so uint8_t is more appropriate.
> 
> Any snmp nerds around?
> 
> clang complained about this:
> 
> /usr/src/usr.sbin/snmpd/snmpd.c:349:47: warning: implicit conversion from 
> 'int' to 'char' changes value from 128 to -128 [-Wconstant-conversion]
>         env->sc_engineid[(env->sc_engineid_len)++] = SNMP_ENGINEID_FMT_EID;
>                                                    ~ ^~~~~~~~~~~~~~~~~~~~~
> /usr/src/usr.sbin/snmpd/snmpd.h:80:31: note: expanded from macro 
> 'SNMP_ENGINEID_FMT_EID'
>                                 ^~~
> 
> diff --git snmpd/snmpd.h snmpd/snmpd.h
> index 91186f23e42..ce1902bdc03 100644
> --- snmpd/snmpd.h
> +++ snmpd/snmpd.h
> @@ -438,7 +438,7 @@ struct snmp_message {
>       long long                sm_secmodel;
>       u_int32_t                sm_engine_boots;
>       u_int32_t                sm_engine_time;
> -     char                     sm_ctxengineid[SNMPD_MAXENGINEIDLEN];
> +     uint8_t                  sm_ctxengineid[SNMPD_MAXENGINEIDLEN];
>       size_t                   sm_ctxengineid_len;
>       char                     sm_ctxname[SNMPD_MAXCONTEXNAMELEN+1];
>  
> @@ -574,7 +574,7 @@ struct snmpd {
>       char                     sc_rwcommunity[SNMPD_MAXCOMMUNITYLEN];
>       char                     sc_trcommunity[SNMPD_MAXCOMMUNITYLEN];
>  
> -     char                     sc_engineid[SNMPD_MAXENGINEIDLEN];
> +     uint8_t                  sc_engineid[SNMPD_MAXENGINEIDLEN];
>       size_t                   sc_engineid_len;
>  
>       struct snmp_stats        sc_stats;
> 

Looks good, ok gerhard@

Reply via email to