# HG changeset patch # User asl # Date 1048611436 0 # Node ID 1c7cb34bec1be82f341d8ced16b29ee0fdaa63d0 # Parent 7b1ce5baf938ba2d3b29daec73a012e43e694f34 Imported from trunk into 2.0 branch: * src/keytools.c (decode_keychange): Avoid undefined behaviour. (encode_keychange): Ditto. Imported from trunk into the 2.0 branch: * include/config.h: Make random use rand on FreeBSD. * include/system.h: For FreeBSD include param.h so we get the aliases. #Undefine printf so stdio.h will compile. printf is not used anywhere. diff --git a/packages/net/snmp/lib/current/ChangeLog b/packages/net/snmp/lib/current/ChangeLog --- a/packages/net/snmp/lib/current/ChangeLog +++ b/packages/net/snmp/lib/current/ChangeLog @@ -1,3 +1,16 @@ +2003-03-25 Jonathan Larmour + + Imported from trunk into 2.0 branch: + * src/keytools.c (decode_keychange): Avoid undefined behaviour. + (encode_keychange): Ditto. + +2003-02-25 Andrew Lunn + + Imported from trunk into the 2.0 branch: + * include/config.h: Make random use rand on FreeBSD. + * include/system.h: For FreeBSD include param.h so we get the aliases. + #Undefine printf so stdio.h will compile. printf is not used anywhere. + 2003-02-24 Jonathan Larmour * cdl/snmplib.cdl: Add doc link. diff --git a/packages/net/snmp/lib/current/include/config.h b/packages/net/snmp/lib/current/include/config.h --- a/packages/net/snmp/lib/current/include/config.h +++ b/packages/net/snmp/lib/current/include/config.h @@ -1157,7 +1157,14 @@ CONNECTION WITH THE USE OR PERFORMANCE O #define srandom(s) srand48(s) #else #ifdef HAVE_RAND +#ifdef __ECOS +#include +#ifndef CYGPKG_NET_FREEBSD_STACK + #define random rand + +#endif //CYGPKG_NET_FREEBSD_STACK +#endif // __ECOS #define srandom(s) srand(s) #endif #endif @@ -1221,7 +1228,7 @@ CONNECTION WITH THE USE OR PERFORMANCE O #define HAVE_SYS_FILE_H 0 #define HAVE_KSTAT_H 0 #define HAVE_SYS_UN_H 0 -#define SOCK_MAXADDRLEN 0 +#define SOCK_MAXADDRLEN 255 #define HAVE_SYS_STREAM_H 0 #define HAVE_INET_MIB2_H 0 #define HAVE_GETPID 0 diff --git a/packages/net/snmp/lib/current/include/system.h b/packages/net/snmp/lib/current/include/system.h --- a/packages/net/snmp/lib/current/include/system.h +++ b/packages/net/snmp/lib/current/include/system.h @@ -189,6 +189,14 @@ char *strdup (const char *); int setenv (const char *, const char *, int); #endif +#ifdef __ECOS +#include +#ifdef CYGPKG_NET_FREEBSD_STACK +#include +#undef printf +#endif //CYGPKG_NET_FREEBSD_STACK +#endif // __ECOS + #if TIME_WITH_SYS_TIME # ifdef WIN32 # include diff --git a/packages/net/snmp/lib/current/src/keytools.c b/packages/net/snmp/lib/current/src/keytools.c --- a/packages/net/snmp/lib/current/src/keytools.c +++ b/packages/net/snmp/lib/current/src/keytools.c @@ -507,7 +507,8 @@ encode_keychange( oid *hashtype, u_int kcstring += properlength; nbytes = 0; while ((int)(nbytes++) < properlength) { - *kcstring++ = *kcstring ^ *newkey++; + u_char kcs = *kcstring; + *kcstring++ = kcs ^ *newkey++; } } @@ -624,7 +625,8 @@ decode_keychange( oid *hashtype, u_int bufp = kcstring+properlength; nbytes = 0; while ((int)(nbytes++) < properlength) { - *newkey++ = *newkey ^ *bufp++; + u_char nk = *newkey; + *newkey++ = nk ^ *bufp++; } }