]> git.vomp.tv Git - vompclient.git/commitdiff
Fix segfault in wselectlist due to missing thread safety
authorMarten Richter <marten.richter@freenet.de>
Sun, 12 Oct 2014 18:06:10 +0000 (20:06 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sun, 12 Oct 2014 18:06:10 +0000 (20:06 +0200)
wselectlist.cc

index ad56e2df1a458428e15092e179e08bc5d6558b1b..7a08144023ad3979f92c1de3d658a6a986a35391 100644 (file)
@@ -180,13 +180,14 @@ void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, cons
     strncpy(buffer, text, 199);
     int currentColumn = taboffset;
     char* pointer;
+    char* savepointer;
 
-    pointer = strtok(buffer, "\t\n");
+    pointer = strtok_r(buffer, "\t\n", &savepointer);
     while(pointer)
     {
       drawText(pointer, xposmod + columns[currentColumn], ypos_mod + curline * fontHeight, width - columns[currentColumn], colour);
 
-      pointer = strtok(NULL, "\t\n");
+      pointer = strtok_r(NULL, "\t\n", &savepointer);
       if (pointer) {
          char delimiter = text[pointer - buffer-1];
          if (delimiter == '\t') currentColumn++;