git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7255
d7cf8633-e32d-0410-b094-
e92efae38249
int separatorlen[7];
const char *separators[7];
const char *p;
int separatorlen[7];
const char *separators[7];
const char *p;
char tokentext[MAX_INPUTLINE];
VM_SAFEPARMCOUNTRANGE(2, 8,VM_tokenizebyseparator);
char tokentext[MAX_INPUTLINE];
VM_SAFEPARMCOUNTRANGE(2, 8,VM_tokenizebyseparator);
- 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])))
while (*p)
{
for (k = 0;k < numseparators;k++)
while (*p)
{
for (k = 0;k < numseparators;k++)
}
if (k < numseparators)
break;
}
if (k < numseparators)
break;
- if (j < (int)sizeof(tokentext[MAX_INPUTLINE]-1))
+ if (j < (int)sizeof(tokentext)-1)
tokentext[j++] = *p;
p++;
}
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);