Commit ff7f3adc ff7f3adc01f6c753c078e7a4012d1040f343c124 by Sergey Poznyakoff

(mh_is_my_name): Bugfix: do not use strtok_r, which modifies its argument.

1 parent 975185d5
...@@ -169,12 +169,36 @@ mh_is_my_name (char *name) ...@@ -169,12 +169,36 @@ mh_is_my_name (char *name)
169 char *nlist = mh_global_profile_get ("Alternate-Mailboxes", NULL); 169 char *nlist = mh_global_profile_get ("Alternate-Mailboxes", NULL);
170 if (nlist) 170 if (nlist)
171 { 171 {
172 char *p, *sp; 172 char *end, *p, *pat;
173 int len;
173 174
174 p = strtok_r (nlist, ",", &sp); 175 for (p = nlist; rc == 0 && *p; p = end)
175 do 176 {
176 rc = emailcmp (p, pname) == 0; 177
177 while (rc == 0 && (p = strtok_r (NULL, ",", &sp))); 178 while (*p && isspace (*p))
179 p++;
180
181 end = strchr (p, ',');
182 if (end)
183 {
184 len = end - p;
185 end++;
186 }
187 else
188 {
189 len = strlen (p);
190 end = p + len;
191 }
192
193 while (len > 0 && isspace (p[len-1]))
194 len--;
195
196 pat = xmalloc (len + 1);
197 memcpy (pat, p, len);
198 pat[len] = 0;
199 rc = emailcmp (pat, pname) == 0;
200 free (pat);
201 }
178 } 202 }
179 } 203 }
180 free (pname); 204 free (pname);
......