Partial implementation of fix for Got_RequestAddfilecmd (the other half - the limitation on the size of the filesneeded section of the serverinfo packet - will be applied in internal.)

This commit is contained in:
toasterbabe 2017-05-25 15:34:21 +01:00
parent 2aa1215716
commit 5c302d7ffc

View file

@ -3078,6 +3078,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
filestatus_t ncs = FS_NOTFOUND;
UINT8 md5sum[16];
boolean kick = false;
boolean toomany = false;
INT32 i;
READSTRINGN(*cp, filename, 240);
@ -3104,13 +3105,18 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
return;
}
if (numwadfiles >= MAX_WADFILES) // a more comprehensive check in internal; bare minimum of out-of-bounds for public next
toomany = true;
else
ncs = findfile(filename,md5sum,true);
if (ncs != FS_FOUND)
if (ncs != FS_FOUND || toomany)
{
char message[256];
if (ncs == FS_NOTFOUND)
if (toomany)
sprintf(message, M_GetText("Too many files loaded to add %s\n"), filename);
else if (ncs == FS_NOTFOUND)
sprintf(message, M_GetText("The server doesn't have %s\n"), filename);
else if (ncs == FS_MD5SUMBAD)
sprintf(message, M_GetText("Checksum mismatch on %s\n"), filename);