Code example taken from the current 1ppv4.1.0's; 1pp/install/202_spelltweak.tph:
ACTION_IF (FILE_EXISTS_IN_GAME ~SPWI317.SPL~) THEN BEGIN COPY_EXISTING ~SPWI317.SPL~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files WRITE_LONG 0x2c2 0 WRITE_ASCII 0x2be ~1WDGARMR~ END BUT_ONLY_IF_IT_CHANGES END
Now the problem with the code is that the files Source size of 0x72 or less is way too short to account the the fact that there is a bites in the 0x2c2 and 0x2be addresses of the file. Especially if the file is modified by any other mod in the chain... so reading an address near the 0x200 could validate the action, better yet reading and make sure the effects OPcode is correct would be better though, but the fact that there's a number at 0x72 does not.
There's surely several of these and so making the file checks a little more thorough will take a lot of coding, but you should make it.
Yeah, I didn't originally see this, but decided to report it here to make sure you see it.
Edited by The Imp, 22 October 2013 - 02:45 AM.