Skip to content
Snippets Groups Projects
Commit f9acb79d authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix unaligned memory accesses as reported by ASan

e.g. runtime error: store to misaligned address 0x7ffec33195e3 for type
'short int', which requires 2 byte alignment

These aren't a problem for x86, but could be a problem for some other CPU
architectures that don't support unaligned access. I didn't use memcpy() to
resolve this (though that would've worked) to make this change endian agnostic.
parent 999c097c
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -60,27 +60,27 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -60,27 +60,27 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
ar[j++]=AR_NOT; ar[j++]=AR_NOT;
not=equal=0; not=equal=0;
ar[j++]=AR_BEGNEST; ar[j++]=AR_BEGNEST;
continue; continue;
} }
if(str[i]==')') { if(str[i]==')') {
ar[j++]=AR_ENDNEST; ar[j++]=AR_ENDNEST;
continue; continue;
} }
if(str[i]=='|') { if(str[i]=='|') {
ar[j++]=AR_OR; ar[j++]=AR_OR;
continue; continue;
} }
if(str[i]=='!') { if(str[i]=='!') {
not=1; not=1;
continue; continue;
} }
if(str[i]=='=') { if(str[i]=='=') {
equal=1; equal=1;
continue; continue;
} }
if(str[i]=='&') if(str[i]=='&')
...@@ -93,36 +93,36 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -93,36 +93,36 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
if(n==2 && !strnicmp(p,"OR",2)) { if(n==2 && !strnicmp(p,"OR",2)) {
ar[j++]=AR_OR; ar[j++]=AR_OR;
i++; i++;
continue; continue;
} }
if(n==3 && !strnicmp(p,"AND",3)) { /* AND is ignored */ if(n==3 && !strnicmp(p,"AND",3)) { /* AND is ignored */
i+=2; i+=2;
continue; continue;
} }
if(n==3 && !strnicmp(p,"NOT",3)) { if(n==3 && !strnicmp(p,"NOT",3)) {
not=1; not=1;
i+=2; i+=2;
continue; continue;
} }
if(n==2 && equal && !strnicmp(p,"TO",2)) { /* EQUAL TO */ if(n==2 && equal && !strnicmp(p,"TO",2)) { /* EQUAL TO */
i++; i++;
continue; continue;
} }
if(n==5 && !strnicmp(p,"EQUAL",5)) { if(n==5 && !strnicmp(p,"EQUAL",5)) {
equal=1; equal=1;
i+=4; i+=4;
continue; continue;
} }
if(n==6 && !strnicmp(p,"EQUALS",6)) { if(n==6 && !strnicmp(p,"EQUALS",6)) {
equal=1; equal=1;
i+=5; i+=5;
continue; continue;
} }
} }
if(str[i]=='$') { if(str[i]=='$') {
...@@ -229,266 +229,266 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -229,266 +229,266 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
arg_expected=FALSE; arg_expected=FALSE;
break; break;
} }
continue; continue;
} }
if(!arg_expected && IS_ALPHA(str[i])) { if(!arg_expected && IS_ALPHA(str[i])) {
n=i; n=i;
if(!strnicmp(str+i,"AGE",3)) { if(!strnicmp(str+i,"AGE",3)) {
artype=AR_AGE; artype=AR_AGE;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"BPS",3)) { else if(!strnicmp(str+i,"BPS",3)) {
artype=AR_BPS; artype=AR_BPS;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"PCR",3)) { else if(!strnicmp(str+i,"PCR",3)) {
artype=AR_PCR; artype=AR_PCR;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"SEX",3)) { else if(!strnicmp(str+i,"SEX",3)) {
artype=AR_SEX; artype=AR_SEX;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"UDR",3)) { else if(!strnicmp(str+i,"UDR",3)) {
artype=AR_UDR; artype=AR_UDR;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"ULS",3)) { else if(!strnicmp(str+i,"ULS",3)) {
artype=AR_ULS; artype=AR_ULS;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"ULK",3)) { else if(!strnicmp(str+i,"ULK",3)) {
artype=AR_ULK; artype=AR_ULK;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"ULM",3)) { else if(!strnicmp(str+i,"ULM",3)) {
artype=AR_ULM; artype=AR_ULM;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"DLS",3)) { else if(!strnicmp(str+i,"DLS",3)) {
artype=AR_DLS; artype=AR_DLS;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"DLK",3)) { else if(!strnicmp(str+i,"DLK",3)) {
artype=AR_DLK; artype=AR_DLK;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"DLM",3)) { else if(!strnicmp(str+i,"DLM",3)) {
artype=AR_DLM; artype=AR_DLM;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"DAY",3)) { else if(!strnicmp(str+i,"DAY",3)) {
artype=AR_DAY; artype=AR_DAY;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"RIP",3)) { else if(!strnicmp(str+i,"RIP",3)) {
artype=AR_RIP; artype=AR_RIP;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"WIP",3)) { else if(!strnicmp(str+i,"WIP",3)) {
artype=AR_WIP; artype=AR_WIP;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"OS2",3)) { else if(!strnicmp(str+i,"OS2",3)) {
artype=AR_OS2; artype=AR_OS2;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"DOS",3)) { else if(!strnicmp(str+i,"DOS",3)) {
artype=AR_DOS; artype=AR_DOS;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"WIN32",5)) { else if(!strnicmp(str+i,"WIN32",5)) {
artype=AR_WIN32; artype=AR_WIN32;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"UNIX",4)) { else if(!strnicmp(str+i,"UNIX",4)) {
artype=AR_UNIX; artype=AR_UNIX;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"LINUX",5)) { else if(!strnicmp(str+i,"LINUX",5)) {
artype=AR_LINUX; artype=AR_LINUX;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"PROT",4)) { else if(!strnicmp(str+i,"PROT",4)) {
artype=AR_PROT; artype=AR_PROT;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"HOST",4)) { else if(!strnicmp(str+i,"HOST",4)) {
artype=AR_HOST; artype=AR_HOST;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"IP",2)) { else if(!strnicmp(str+i,"IP",2)) {
artype=AR_IP; artype=AR_IP;
i++; i++;
} }
else if(!strnicmp(str+i,"SUBCODE",7)) { else if(!strnicmp(str+i,"SUBCODE",7)) {
artype=AR_SUBCODE; artype=AR_SUBCODE;
i+=6; i+=6;
} }
else if(!strnicmp(str+i,"SUB",3)) { else if(!strnicmp(str+i,"SUB",3)) {
artype=AR_SUB; artype=AR_SUB;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"LIB",3)) { else if(!strnicmp(str+i,"LIB",3)) {
artype=AR_LIB; artype=AR_LIB;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"DIRCODE",7)) { else if(!strnicmp(str+i,"DIRCODE",7)) {
artype=AR_DIRCODE; artype=AR_DIRCODE;
i+=6; i+=6;
} }
else if(!strnicmp(str+i,"DIR",3)) { else if(!strnicmp(str+i,"DIR",3)) {
artype=AR_DIR; artype=AR_DIR;
i+=2; i+=2;
} }
else if(!strnicmp(str+i,"ANSI",4)) { else if(!strnicmp(str+i,"ANSI",4)) {
artype=AR_ANSI; artype=AR_ANSI;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"PETSCII",7)) { else if(!strnicmp(str+i,"PETSCII",7)) {
artype=AR_PETSCII; artype=AR_PETSCII;
i+=6; i+=6;
} }
else if(!strnicmp(str+i,"ASCII",5)) { else if(!strnicmp(str+i,"ASCII",5)) {
artype=AR_ASCII; artype=AR_ASCII;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"UTF8",4)) { else if(!strnicmp(str+i,"UTF8",4)) {
artype=AR_UTF8; artype=AR_UTF8;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"CP437",5)) { else if(!strnicmp(str+i,"CP437",5)) {
artype=AR_CP437; artype=AR_CP437;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"TERM",4)) { else if(!strnicmp(str+i,"TERM",4)) {
artype=AR_TERM; artype=AR_TERM;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"COLS",4)) { else if(!strnicmp(str+i,"COLS",4)) {
artype=AR_COLS; artype=AR_COLS;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"ROWS",4)) { else if(!strnicmp(str+i,"ROWS",4)) {
artype=AR_ROWS; artype=AR_ROWS;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"UDFR",4)) { else if(!strnicmp(str+i,"UDFR",4)) {
artype=AR_UDFR; artype=AR_UDFR;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"FLAG",4)) { else if(!strnicmp(str+i,"FLAG",4)) {
artype=AR_FLAG1; artype=AR_FLAG1;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"NODE",4)) { else if(!strnicmp(str+i,"NODE",4)) {
artype=AR_NODE; artype=AR_NODE;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"NULL",4)) { else if(!strnicmp(str+i,"NULL",4)) {
artype=AR_NULL; artype=AR_NULL;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"USER",4)) { else if(!strnicmp(str+i,"USER",4)) {
artype=AR_USER; artype=AR_USER;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"TIME",4)) { else if(!strnicmp(str+i,"TIME",4)) {
artype=AR_TIME; artype=AR_TIME;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"REST",4)) { else if(!strnicmp(str+i,"REST",4)) {
artype=AR_REST; artype=AR_REST;
i+=3; i+=3;
} }
else if(!strnicmp(str+i,"LEVEL",5)) { else if(!strnicmp(str+i,"LEVEL",5)) {
artype=AR_LEVEL; artype=AR_LEVEL;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"TLEFT",5)) { else if(!strnicmp(str+i,"TLEFT",5)) {
artype=AR_TLEFT; artype=AR_TLEFT;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"TUSED",5)) { else if(!strnicmp(str+i,"TUSED",5)) {
artype=AR_TUSED; artype=AR_TUSED;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"LOCAL",5)) { else if(!strnicmp(str+i,"LOCAL",5)) {
artype=AR_LOCAL; artype=AR_LOCAL;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"GROUP",5)) { else if(!strnicmp(str+i,"GROUP",5)) {
artype=AR_GROUP; artype=AR_GROUP;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"EXPIRE",6)) { else if(!strnicmp(str+i,"EXPIRE",6)) {
artype=AR_EXPIRE; artype=AR_EXPIRE;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"ACTIVE",6)) { else if(!strnicmp(str+i,"ACTIVE",6)) {
artype=AR_ACTIVE; artype=AR_ACTIVE;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"INACTIVE",8)) { else if(!strnicmp(str+i,"INACTIVE",8)) {
artype=AR_INACTIVE; artype=AR_INACTIVE;
i+=7; i+=7;
} }
else if(!strnicmp(str+i,"DELETED",7)) { else if(!strnicmp(str+i,"DELETED",7)) {
artype=AR_DELETED; artype=AR_DELETED;
i+=6; i+=6;
} }
else if(!strnicmp(str+i,"EXPERT",6)) { else if(!strnicmp(str+i,"EXPERT",6)) {
artype=AR_EXPERT; artype=AR_EXPERT;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"SYSOP",5)) { else if(!strnicmp(str+i,"SYSOP",5)) {
artype=AR_SYSOP; artype=AR_SYSOP;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"GUEST",5)) { else if(!strnicmp(str+i,"GUEST",5)) {
artype=AR_GUEST; artype=AR_GUEST;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"QNODE",5)) { else if(!strnicmp(str+i,"QNODE",5)) {
artype=AR_QNODE; artype=AR_QNODE;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"QUIET",5)) { else if(!strnicmp(str+i,"QUIET",5)) {
artype=AR_QUIET; artype=AR_QUIET;
i+=4; i+=4;
} }
else if(!strnicmp(str+i,"EXEMPT",6)) { else if(!strnicmp(str+i,"EXEMPT",6)) {
artype=AR_EXEMPT; artype=AR_EXEMPT;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"RANDOM",6)) { else if(!strnicmp(str+i,"RANDOM",6)) {
artype=AR_RANDOM; artype=AR_RANDOM;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"LASTON",6)) { else if(!strnicmp(str+i,"LASTON",6)) {
artype=AR_LASTON; artype=AR_LASTON;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"LOGONS",6)) { else if(!strnicmp(str+i,"LOGONS",6)) {
artype=AR_LOGONS; artype=AR_LOGONS;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"CREDIT",6)) { else if(!strnicmp(str+i,"CREDIT",6)) {
artype=AR_CREDIT; artype=AR_CREDIT;
i+=5; i+=5;
} }
else if(!strnicmp(str+i,"MAIN_CMDS",9)) { else if(!strnicmp(str+i,"MAIN_CMDS",9)) {
artype=AR_MAIN_CMDS; artype=AR_MAIN_CMDS;
i+=8; i+=8;
} }
else if(!strnicmp(str+i,"FILE_CMDS",9)) { else if(!strnicmp(str+i,"FILE_CMDS",9)) {
artype=AR_FILE_CMDS; artype=AR_FILE_CMDS;
i+=8; i+=8;
} }
else if(!strnicmp(str+i,"SHELL",5)) { else if(!strnicmp(str+i,"SHELL",5)) {
artype=AR_SHELL; artype=AR_SHELL;
i+=4; i+=4;
} }
if(n!=i) /* one of the above */ if(n!=i) /* one of the above */
...@@ -525,7 +525,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -525,7 +525,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
arg_expected=FALSE; arg_expected=FALSE;
break; break;
} }
continue; continue;
} }
} }
if(not) if(not)
...@@ -544,9 +544,9 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -544,9 +544,9 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
break; break;
case '4': case '4':
artype=AR_FLAG4; artype=AR_FLAG4;
break; break;
} }
continue; continue;
} }
arg_expected=FALSE; arg_expected=FALSE;
...@@ -565,10 +565,10 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -565,10 +565,10 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
p=strchr(str+i,':'); p=strchr(str+i,':');
if(p) if(p)
n+=atoi(p+1); n+=atoi(p+1);
*((short *)(ar+j))=n; ar[j++] = n & 0xff;
j+=2; ar[j++] = (n >> 8) & 0xff;
while(IS_DIGIT(str[i+1]) || str[i+1]==':') i++; while(IS_DIGIT(str[i+1]) || str[i+1]==':') i++;
continue; continue;
} }
n=atoi(str+i); n=atoi(str+i);
switch(artype) { switch(artype) {
...@@ -606,23 +606,23 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -606,23 +606,23 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
case AR_DLS: case AR_DLS:
case AR_DLK: case AR_DLK:
case AR_DLM: case AR_DLM:
*((short *)(ar+j))=n; ar[j++] = n & 0xff;
j+=sizeof(short); ar[j++] = (n >> 8) & 0xff;
break; break;
case AR_GROUP: case AR_GROUP:
case AR_LIB: case AR_LIB:
case AR_DIR: case AR_DIR:
case AR_SUB: case AR_SUB:
if(n) n--; /* convert to 0 base */ if(n > 0) n--; /* convert to 0 base */
*((short *)(ar+j))=n; ar[j++] = n & 0xff;
j+=2; ar[j++] = (n >> 8) & 0xff;
break; break;
default: /* invalid numeric AR type */ default: /* invalid numeric AR type */
j--; j--;
break; break;
} }
while(IS_DIGIT(str[i+1])) i++; while(IS_DIGIT(str[i+1])) i++;
continue; continue;
} }
maxlen=128; maxlen=128;
switch(artype) { switch(artype) {
...@@ -663,8 +663,8 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -663,8 +663,8 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
if(!strnicmp(str+i,cfg->sub[n]->code,strlen(cfg->sub[n]->code))) if(!strnicmp(str+i,cfg->sub[n]->code,strlen(cfg->sub[n]->code)))
break; break;
if(n<(uint)cfg->total_subs) { if(n<(uint)cfg->total_subs) {
*((short *)(ar+j))=n; ar[j++] = n & 0xff;
j+=2; ar[j++] = (n >> 8) & 0xff;
} }
else /* Unknown sub-board */ else /* Unknown sub-board */
j--; j--;
...@@ -675,25 +675,25 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -675,25 +675,25 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
if(!strnicmp(str+i,cfg->dir[n]->code,strlen(cfg->dir[n]->code))) if(!strnicmp(str+i,cfg->dir[n]->code,strlen(cfg->dir[n]->code)))
break; break;
if(n<(uint)cfg->total_dirs) { if(n<(uint)cfg->total_dirs) {
*((short *)(ar+j))=n; ar[j++] = n & 0xff;
j+=2; ar[j++] = (n >> 8) & 0xff;
} }
else /* Unknown directory */ else /* Unknown directory */
j--; j--;
while(IS_ALPHA(str[i+1])) i++; while(IS_ALPHA(str[i+1])) i++;
break; break;
case AR_DAY: case AR_DAY:
if(toupper(str[i])=='S' if(toupper(str[i])=='S'
&& toupper(str[i+1])=='U') /* Sunday */ && toupper(str[i+1])=='U') /* Sunday */
ar[j++]=0; ar[j++]=0;
else if(toupper(str[i])=='M') /* Monday */ else if(toupper(str[i])=='M') /* Monday */
ar[j++]=1; ar[j++]=1;
else if(toupper(str[i])=='T' else if(toupper(str[i])=='T'
&& toupper(str[i+1])=='U') /* Tuesday */ && toupper(str[i+1])=='U') /* Tuesday */
ar[j++]=2; ar[j++]=2;
else if(toupper(str[i])=='W') /* Wednesday */ else if(toupper(str[i])=='W') /* Wednesday */
ar[j++]=3; ar[j++]=3;
else if(toupper(str[i])=='T' else if(toupper(str[i])=='T'
&& toupper(str[i+1])=='H') /* Thursday */ && toupper(str[i+1])=='H') /* Thursday */
ar[j++]=4; ar[j++]=4;
else if(toupper(str[i])=='F') /* Friday */ else if(toupper(str[i])=='F') /* Friday */
...@@ -704,7 +704,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -704,7 +704,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
default: /* Badly formed ARS, digit expected */ default: /* Badly formed ARS, digit expected */
j--; j--;
break; break;
} }
} }
ar[j++]=AR_NULL; ar[j++]=AR_NULL;
...@@ -740,7 +740,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -740,7 +740,7 @@ char *decompile_ars(uchar *ars, int len)
break; break;
case AR_OR: case AR_OR:
*(out++)='|'; *(out++)='|';
break; break;
case AR_NOT: case AR_NOT:
not=1; not=1;
...@@ -753,120 +753,120 @@ char *decompile_ars(uchar *ars, int len) ...@@ -753,120 +753,120 @@ char *decompile_ars(uchar *ars, int len)
*(out++)='!'; *(out++)='!';
not=0; not=0;
*(out++)='('; *(out++)='(';
break; break;
case AR_ENDNEST: case AR_ENDNEST:
*(out++)=')'; *(out++)=')';
break; break;
case AR_LEVEL: case AR_LEVEL:
*(out++)='$'; *(out++)='$';
*(out++)='L'; *(out++)='L';
break; break;
case AR_AGE: case AR_AGE:
*(out++)='$'; *(out++)='$';
*(out++)='A'; *(out++)='A';
break; break;
case AR_BPS: case AR_BPS:
*(out++)='$'; *(out++)='$';
*(out++)='B'; *(out++)='B';
break; break;
case AR_NODE: case AR_NODE:
*(out++)='$'; *(out++)='$';
*(out++)='N'; *(out++)='N';
break; break;
case AR_TLEFT: case AR_TLEFT:
*(out++)='$'; *(out++)='$';
*(out++)='R'; *(out++)='R';
break; break;
case AR_TUSED: case AR_TUSED:
*(out++)='$'; *(out++)='$';
*(out++)='O'; *(out++)='O';
break; break;
case AR_USER: case AR_USER:
*(out++)='$'; *(out++)='$';
*(out++)='U'; *(out++)='U';
break; break;
case AR_TIME: case AR_TIME:
*(out++)='$'; *(out++)='$';
*(out++)='T'; *(out++)='T';
break; break;
case AR_PCR: case AR_PCR:
*(out++)='$'; *(out++)='$';
*(out++)='P'; *(out++)='P';
break; break;
case AR_FLAG1: case AR_FLAG1:
*(out++)='$'; *(out++)='$';
*(out++)='F'; *(out++)='F';
*(out++)='1'; *(out++)='1';
break; break;
case AR_FLAG2: case AR_FLAG2:
*(out++)='$'; *(out++)='$';
*(out++)='F'; *(out++)='F';
*(out++)='2'; *(out++)='2';
break; break;
case AR_FLAG3: case AR_FLAG3:
*(out++)='$'; *(out++)='$';
*(out++)='F'; *(out++)='F';
*(out++)='3'; *(out++)='3';
break; break;
case AR_FLAG4: case AR_FLAG4:
*(out++)='$'; *(out++)='$';
*(out++)='F'; *(out++)='F';
*(out++)='4'; *(out++)='4';
break; break;
case AR_EXEMPT: case AR_EXEMPT:
*(out++)='$'; *(out++)='$';
*(out++)='X'; *(out++)='X';
break; break;
case AR_REST: case AR_REST:
*(out++)='$'; *(out++)='$';
*(out++)='Z'; *(out++)='Z';
break; break;
case AR_SEX: case AR_SEX:
*(out++)='$'; *(out++)='$';
*(out++)='S'; *(out++)='S';
break; break;
case AR_UDR: case AR_UDR:
*(out++)='$'; *(out++)='$';
*(out++)='K'; *(out++)='K';
break; break;
case AR_UDFR: case AR_UDFR:
*(out++)='$'; *(out++)='$';
*(out++)='D'; *(out++)='D';
break; break;
case AR_EXPIRE: case AR_EXPIRE:
*(out++)='$'; *(out++)='$';
*(out++)='E'; *(out++)='E';
break; break;
case AR_CREDIT: case AR_CREDIT:
*(out++)='$'; *(out++)='$';
*(out++)='C'; *(out++)='C';
break; break;
case AR_DAY: case AR_DAY:
*(out++)='$'; *(out++)='$';
*(out++)='W'; *(out++)='W';
break; break;
case AR_ANSI: case AR_ANSI:
if(not) if(not)
...@@ -874,7 +874,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -874,7 +874,7 @@ char *decompile_ars(uchar *ars, int len)
not=0; not=0;
*(out++)='$'; *(out++)='$';
*(out++)='['; *(out++)='[';
break; break;
case AR_RIP: case AR_RIP:
if(not) if(not)
...@@ -882,7 +882,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -882,7 +882,7 @@ char *decompile_ars(uchar *ars, int len)
not=0; not=0;
*(out++)='$'; *(out++)='$';
*(out++)='*'; *(out++)='*';
break; break;
case AR_LOCAL: case AR_LOCAL:
if(not) if(not)
...@@ -890,27 +890,27 @@ char *decompile_ars(uchar *ars, int len) ...@@ -890,27 +890,27 @@ char *decompile_ars(uchar *ars, int len)
not=0; not=0;
*(out++)='$'; *(out++)='$';
*(out++)='G'; *(out++)='G';
break; break;
case AR_GROUP: case AR_GROUP:
*(out++)='$'; *(out++)='$';
*(out++)='M'; *(out++)='M';
break; break;
case AR_SUB: case AR_SUB:
*(out++)='$'; *(out++)='$';
*(out++)='H'; *(out++)='H';
break; break;
case AR_LIB: case AR_LIB:
*(out++)='$'; *(out++)='$';
*(out++)='I'; *(out++)='I';
break; break;
case AR_DIR: case AR_DIR:
*(out++)='$'; *(out++)='$';
*(out++)='J'; *(out++)='J';
break; break;
case AR_EXPERT : case AR_EXPERT :
if(not) if(not)
...@@ -919,7 +919,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -919,7 +919,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"EXPERT"); strcat(out,"EXPERT");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_SYSOP: case AR_SYSOP:
if(not) if(not)
...@@ -928,7 +928,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -928,7 +928,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"SYSOP"); strcat(out,"SYSOP");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_QUIET: case AR_QUIET:
if(not) if(not)
...@@ -937,34 +937,34 @@ char *decompile_ars(uchar *ars, int len) ...@@ -937,34 +937,34 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"QUIET"); strcat(out,"QUIET");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_MAIN_CMDS: case AR_MAIN_CMDS:
*out=0; *out=0;
strcat(out,"MAIN_CMDS"); strcat(out,"MAIN_CMDS");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_FILE_CMDS: case AR_FILE_CMDS:
*out=0; *out=0;
strcat(out,"FILE_CMDS"); strcat(out,"FILE_CMDS");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_RANDOM: case AR_RANDOM:
*(out++)='$'; *(out++)='$';
*(out++)='Q'; *(out++)='Q';
break; break;
case AR_LASTON: case AR_LASTON:
*(out++)='$'; *(out++)='$';
*(out++)='Y'; *(out++)='Y';
break; break;
case AR_LOGONS: case AR_LOGONS:
*(out++)='$'; *(out++)='$';
*(out++)='V'; *(out++)='V';
break; break;
case AR_WIP: case AR_WIP:
if(not) if(not)
...@@ -973,19 +973,19 @@ char *decompile_ars(uchar *ars, int len) ...@@ -973,19 +973,19 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"WIP"); strcat(out,"WIP");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_SUBCODE: case AR_SUBCODE:
*out=0; *out=0;
strcat(out,"SUB "); strcat(out,"SUB ");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_DIRCODE: case AR_DIRCODE:
*out=0; *out=0;
strcat(out,"DIR "); strcat(out,"DIR ");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_OS2: case AR_OS2:
if(not) if(not)
...@@ -994,7 +994,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -994,7 +994,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"OS2"); strcat(out,"OS2");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_DOS: case AR_DOS:
if(not) if(not)
...@@ -1003,7 +1003,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1003,7 +1003,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"DOS"); strcat(out,"DOS");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_WIN32: case AR_WIN32:
if(not) if(not)
...@@ -1012,7 +1012,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1012,7 +1012,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"WIN32"); strcat(out,"WIN32");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_UNIX: case AR_UNIX:
if(not) if(not)
...@@ -1021,7 +1021,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1021,7 +1021,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"UNIX"); strcat(out,"UNIX");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_LINUX : case AR_LINUX :
if(not) if(not)
...@@ -1030,31 +1030,31 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1030,31 +1030,31 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"LINUX"); strcat(out,"LINUX");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_SHELL: case AR_SHELL:
*out=0; *out=0;
strcat(out,"SHELL "); strcat(out,"SHELL ");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_PROT: case AR_PROT:
*out=0; *out=0;
strcat(out,"PROT "); strcat(out,"PROT ");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_HOST: case AR_HOST:
*out=0; *out=0;
strcat(out,"HOST "); strcat(out,"HOST ");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_IP: case AR_IP:
*out=0; *out=0;
strcat(out,"IP "); strcat(out,"IP ");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_GUEST: case AR_GUEST:
if(not) if(not)
...@@ -1063,7 +1063,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1063,7 +1063,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"GUEST"); strcat(out,"GUEST");
out=strchr(out,0); out=strchr(out,0);
break; break;
case AR_QNODE: case AR_QNODE:
if(not) if(not)
...@@ -1072,7 +1072,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1072,7 +1072,7 @@ char *decompile_ars(uchar *ars, int len)
*out=0; *out=0;
strcat(out,"QNODE"); strcat(out,"QNODE");
out=strchr(out,0); out=strchr(out,0);
break; break;
default: default:
printf("Error decoding AR: %02Xh, offset: %u\n", *in, in-ars); printf("Error decoding AR: %02Xh, offset: %u\n", *in, in-ars);
......
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