net-snmp/net-snmp-5.7.3-strtok-r.patch

20 lines
965 B
Diff
Raw Normal View History

diff -urNp net-snmp-5.7.3/snmplib/snmp_transport.c net-snmp-5.7.3.new/snmplib/snmp_transport.c
--- net-snmp-5.7.3/snmplib/snmp_transport.c 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3.new/snmplib/snmp_transport.c 2016-08-12 13:04:35.438583586 +0200
@@ -594,12 +594,13 @@ netsnmp_tdomain_transport_full(const cha
int commas = 0;
const char *cp = default_domain;
char *dup = strdup(default_domain);
+ char *ptr = NULL;
while (*++cp) if (*cp == ',') commas++;
lspec = calloc(commas+2, sizeof(char *));
commas = 1;
- lspec[0] = strtok(dup, ",");
- while ((lspec[commas++] = strtok(NULL, ",")))
+ lspec[0] = strtok_r(dup, ",", &ptr);
+ while ((lspec[commas++] = strtok_r(NULL, ",", &ptr)))
;
spec = (const char * const *)lspec;
}