mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- fix dangerous pointer arithmetic in ParseCommandLine
Should be rewritten entirely to sanitize, though.
This commit is contained in:
parent
8d423fdc6f
commit
7e36e57639
2 changed files with 8 additions and 6 deletions
|
@ -57,17 +57,19 @@
|
|||
// \c becomes just TEXTCOLOR_ESCAPE
|
||||
// $<cvar> is replaced by the contents of <cvar>
|
||||
|
||||
static long ParseCommandLine(const char* args, int* argc, char** argv, bool no_escapes)
|
||||
static size_t ParseCommandLine(const char* args, int* argc, char** argv, bool no_escapes)
|
||||
{
|
||||
int count;
|
||||
char* buffstart;
|
||||
char* buffplace;
|
||||
|
||||
count = 0;
|
||||
buffplace = NULL;
|
||||
buffstart = NULL;
|
||||
if (argv != NULL)
|
||||
{
|
||||
buffplace = argv[0];
|
||||
buffstart = argv[0];
|
||||
}
|
||||
buffplace = buffstart;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -154,7 +156,7 @@ static long ParseCommandLine(const char* args, int* argc, char** argv, bool no_e
|
|||
{
|
||||
*argc = count;
|
||||
}
|
||||
return (long)(buffplace - (char*)0);
|
||||
return (buffplace - buffstart);
|
||||
}
|
||||
|
||||
FCommandLine::FCommandLine (const char *commandline, bool no_escapes)
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
|
||||
private:
|
||||
const char *cmd;
|
||||
bool noescapes;
|
||||
int _argc;
|
||||
char **_argv;
|
||||
long argsize;
|
||||
bool noescapes;
|
||||
size_t argsize;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue