Disallow ".." to appear in paths from the updater.

This commit is contained in:
David Anderson 2009-02-17 16:58:17 -05:00
parent 3d7b0db114
commit ed51d5cf84

View File

@ -127,6 +127,12 @@ static void PumpUpdate(void *data)
UpdatePart *part = (UpdatePart*)data;
while (part != NULL)
{
if (strstr(part->file, "..") != NULL)
{
/* Naughty naughty */
AddUpdateError("Detected invalid path escape (..): %s", part->file);
goto skip_create;
}
if (part->data == NULL)
{
smutils->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s", part->file);
@ -158,6 +164,7 @@ static void PumpUpdate(void *data)
"Successfully updated gamedata file \"%s\"",
part->file);
}
skip_create:
temp = part->next;
free(part->data);
free(part->file);