Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling code from a memo field
Message
 
To
06/07/2005 12:51:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01029391
Message ID:
01029615
Views:
14
> Doesn't exist any way of copying into a file with exclusive access a
> Blob/memo and to execute it with a DO command; a small interval time
> exists where the file is free;
> a good hacker can
> - capture the API FCLOSE event
> - to put to sleep VFP,
> - to modify it ;
> to wake up again VFP that performs confident a different thing.

I don't know that there is a good way around this problem. The Blob/Memo is going to be stored in a file too.

Maybe you could store a check sum in your script table and compare the check sum before you execute the script. You could also check the file size.

You can open the object file read-only to lock it and the script will still execute. I just tried this and it worked:
** create a binary script
STRTOFILE("MESSAGEBOX('Hello World')","temp.prg")
COMPILE temp.prg
cBlob = FILETOSTR("temp.fxp")
DELETE FILE temp.prg
DELETE FILE temp.fxp


** test our function
SECURESCRIPT(cBlob)

***********************************
FUNCTION SECURESCRIPT(cBlob)

cTempFile = ADDBS(SYS(2023))+SYS(2015)+".fxp"
** copy script to temp file
nLen = STRTOFILE(cBlob, cTempFile)
** open file readonly to lock it
hnd = FOPEN(cTempFile)
** check the file size to make sure it is OK
IF FSEEK(hnd,0,2) = nLen
   ** execute it
   DO (cTempFile)
ENDIF
** cleanup
FCLOSE(hnd)
DELETE FILE (cTempFile)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform