int separatorlen[7];
const char *separators[7];
const char *p;
+ const char *token;
char tokentext[MAX_INPUTLINE];
VM_SAFEPARMCOUNTRANGE(2, 8,VM_tokenizebyseparator);
}
num_tokens = 0;
- for (num_tokens = 0;num_tokens < (int)(sizeof(tokens)/sizeof(tokens[0]));num_tokens++)
+ j = 0;
+
+ while (num_tokens < (int)(sizeof(tokens)/sizeof(tokens[0])))
{
+ token = tokentext + j;
while (*p)
{
for (k = 0;k < numseparators;k++)
}
if (k < numseparators)
break;
- if (j < (int)sizeof(tokentext[MAX_INPUTLINE]-1))
+ if (j < (int)sizeof(tokentext)-1)
tokentext[j++] = *p;
p++;
}
- tokentext[j] = 0;
- tokens[num_tokens] = PRVM_SetTempString(tokentext);
+ if (j >= (int)sizeof(tokentext))
+ break;
+ tokentext[j++] = 0;
+ tokens[num_tokens++] = PRVM_SetTempString(token);
if (!*p)
break;
}