File net-snmp-5.7.3-use-strtok_r-for-strtok.patch of Package net-snmp.27328

--- net-snmp-5.7.3.orig/snmplib/snmp_transport.c	2014-12-09 04:23:22.000000000 +0800
+++ net-snmp-5.7.3/snmplib/snmp_transport.c	2022-05-11 17:37:00.000000000 +0800
@@ -594,12 +594,13 @@
                 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;
             }
openSUSE Build Service is sponsored by