tab completion: lower size of filelist_item_t name buffer from MAX_OSPATH to 32 to avoid filling up the zone memory (this limits the length of maps / games you can tab-complete).

Prior to r1153 it was 32 for maps and MAX_OSPATH for mods.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1158 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2015-01-26 23:35:55 +00:00
parent 1311398e80
commit a568c712c1
2 changed files with 6 additions and 8 deletions

View File

@ -720,8 +720,6 @@ tablist is a doubly-linked loop, alphabetized by name
// aka Linux Bash shell. -- S.A.
static char bash_partial[80];
static qboolean bash_singlematch;
static qboolean map_singlematch;
static qboolean mod_singlematch;
void AddToTabList (const char *name, const char *type)
{
@ -786,7 +784,7 @@ void AddToTabList (const char *name, const char *type)
// This is redefined from host_cmd.c
typedef struct filelist_item_s
{
char name[MAX_OSPATH];
char name[32];
struct filelist_item_s *next;
} filelist_item_t;
@ -816,12 +814,12 @@ FindCompletion -- stevenaaus
*/
const char *FindCompletion (const char *partial, filelist_item_t *filelist, int *nummatches_out)
{
static char matched[MAX_OSPATH];
static char matched[32];
char *i_matched, *i_name;
filelist_item_t *file;
int init, match, plen;
memset(matched, 0, MAX_OSPATH);
memset(matched, 0, sizeof(matched));
plen = strlen(partial);
match = 0;
@ -832,8 +830,8 @@ const char *FindCompletion (const char *partial, filelist_item_t *filelist, int
if (init == 0)
{
init = 1;
strncpy (matched, file->name, MAX_OSPATH-1);
matched[MAX_OSPATH-1] = '\0';
strncpy (matched, file->name, sizeof(matched)-1);
matched[sizeof(matched)-1] = '\0';
}
else
{ // find max common

View File

@ -59,7 +59,7 @@ void Host_Quit_f (void)
// to simplify completion code
typedef struct filelist_item_s
{
char name[MAX_OSPATH];
char name[32];
struct filelist_item_s *next;
} filelist_item_t;