1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-05 03:37:43 +00:00

VerifyREL module filetype before trying to load

This commit is contained in:
David Schmenk 2018-03-18 13:38:13 -07:00
parent 309f5d45b0
commit 5a0d9e5751

View File

@ -1025,7 +1025,7 @@ def loadmod(mod)#1
word addr, defaddr, modaddr, modfix, modofst, modend
word deftbl, deflast, codeseg
word moddep, rld, esd, sym
byte lerr, defext, str[16], filename[33]
byte lerr, defext, fileinfo[], str[16], filename[33]
byte header[128]
lerr = 0
//
@ -1040,6 +1040,15 @@ def loadmod(mod)#1
refnum = open(strcpy(@filename,strcat(strcpy(@header, @sysmods), @filename)))
fin
if refnum
header.0 = 3
header:1 = @filename
header:3 = @fileinfo
header.5 = 2
if not syscall($C4, @header) and fileinfo.1 <> $FE // Make sure it's a REL module
close(refnum)
perr = $4A // Incompatible type
return -perr
fin
rdlen = read(refnum, @header, 128)
modsize = header:0
moddep = @header.1