Skip to content
Snippets Groups Projects
Commit f3d85b15 authored by rswindell's avatar rswindell
Browse files

Bug-fixes in ARS compilation:

Wasn't accounting for correct lengths of keywords: WIN32, UNIX, LINUX, and PROT
Didn't support >8 char internal codes in SUBCODE and DIRCODE values
Would skip pass the line (null) terminator causing stack corruption or crash
when parsing values for SUBCODE, DIRCODE, or SHELL keywords as the last
keyword.
parent 01d14bc5
No related branches found
No related tags found
No related merge requests found
...@@ -270,28 +270,28 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg) ...@@ -270,28 +270,28 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
ar[j++]=AR_NOT; ar[j++]=AR_NOT;
not=0; not=0;
ar[j++]=artype; ar[j++]=artype;
i+=2; } i+=4; }
else if(!strnicmp(str+i,"UNIX",4)) { else if(!strnicmp(str+i,"UNIX",4)) {
artype=AR_UNIX; artype=AR_UNIX;
if(not) if(not)
ar[j++]=AR_NOT; ar[j++]=AR_NOT;
not=0; not=0;
ar[j++]=artype; ar[j++]=artype;
i+=2; } i+=3; }
else if(!strnicmp(str+i,"LINUX",5)) { else if(!strnicmp(str+i,"LINUX",5)) {
artype=AR_LINUX; artype=AR_LINUX;
if(not) if(not)
ar[j++]=AR_NOT; ar[j++]=AR_NOT;
not=0; not=0;
ar[j++]=artype; ar[j++]=artype;
i+=2; } i+=4; }
else if(!strnicmp(str+i,"PROT",4)) { else if(!strnicmp(str+i,"PROT",4)) {
artype=AR_PROT; artype=AR_PROT;
if(not) if(not)
ar[j++]=AR_NOT; ar[j++]=AR_NOT;
not=0; not=0;
ar[j++]=artype; ar[j++]=artype;
i+=2; } i+=3; }
else if(!strnicmp(str+i,"SUBCODE",7)) { else if(!strnicmp(str+i,"SUBCODE",7)) {
artype=AR_SUBCODE; artype=AR_SUBCODE;
i+=6; } i+=6; }
...@@ -498,7 +498,7 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg) ...@@ -498,7 +498,7 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
while(isdigit(str[i+1])) i++; while(isdigit(str[i+1])) i++;
continue; } continue; }
if(artype==AR_SUBCODE || artype==AR_DIRCODE || artype==AR_SHELL) { if(artype==AR_SUBCODE || artype==AR_DIRCODE || artype==AR_SHELL) {
for(n=0;n<8 for(n=0;n<LEN_EXTCODE
&& str[i] && str[i]
&& str[i]!=' ' && str[i]!=' '
&& str[i]!='(' && str[i]!='('
...@@ -508,7 +508,9 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg) ...@@ -508,7 +508,9 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
;n++) ;n++)
ar[j++]=toupper(str[i++]); ar[j++]=toupper(str[i++]);
ar[j++]=0; ar[j++]=0;
continue; } i--;
continue;
}
switch(artype) { switch(artype) {
case AR_FLAG1: case AR_FLAG1:
case AR_FLAG2: case AR_FLAG2:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment