Commit b3c59b0e authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Strip ANSI escape sequences from file descriptions

Don't let ANSI terminal control sequence, e.g. from 1337 FILE_ID.DIZs, leak into file descriptions.
parent c73f9bdb
Pipeline #470 passed with stage
in 14 minutes and 3 seconds
......@@ -659,6 +659,7 @@ void DLLCALL putextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext)
char str[MAX_PATH+1],nulbuf[F_EXBSIZE];
int file;
strip_ansi(ext);
strip_invalid_attr(ext); /* eliminate bogus ctrl-a codes */
memset(nulbuf,0,sizeof(nulbuf));
SAFEPRINTF2(str,"%s%s.exb",cfg->dir[dirnum]->data_dir,cfg->dir[dirnum]->code);
......
......@@ -155,6 +155,7 @@ char* prep_file_desc(const char *str, char* dest)
if(dest==NULL && (dest=strdup(str))==NULL)
return NULL;
strip_ansi(dest);
for(i=j=0;str[i];i++)
if(str[i]==CTRL_A && str[i+1]!=0) {
i++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment