I am developing a Commodore 65 emulator:
http://devilmaster.altervista.org/hi65.html
Recently, I have added the support of files, to allow users to create BASIC 10 programs that read and write files.
I also wanted to add compatibility with the BASIC 10 commands DELETE, ERASE and SCRATCH, that delete a file. However, if I insert the function that interprets them into the program, Avast will delete the executable file as soon as the compiler creates it, because it doesn't like the presence of the "remove" function.
This is the code snippet in question. I am absolutely sure this is the culprit, because the executable won't be deleted if I comment it out.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
// check to prevent n00bs from deleting files in other directories,
// executables, libraries or multiple files
for (i=0; aux[i]; i++)
{
if (aux[i]=='\\' ||
aux[i]=='/' ||
(aux[i]=='d' && aux[i+1]=='l' && aux[i+2]=='l') ||
(aux[i]=='e' && aux[i+1]=='x' && aux[i+2]=='e') ||
(aux[i]=='.' && aux[i+1]=='.') ||
aux[i]=='*' ||
aux[i]=='?')
{
forbidden=1;
break;
}
}
if (forbidden)
printerror(INVALIDFILENAME);
else
{
if (remove((const char *)aux)) // if there has been an error in deleting the file
printerror(FILENOTFOUND);
}
|
I am aware that "this proves that Avast works", but it seems to me that it works a little too much, because it effectively disallows the presence of any code containing a certain function. I am also aware that I could just ask users to please disable the antivirus while using the emulator, but a statement like that would make me look like a scumbag. I know I wouldn't trust a person telling me "Oh, if you want to use my program, you'll have to disable the antivirus."
Is disabling that code the only thing I can do?