Commits (1)
  • Robert Sprowson's avatar
    Fix for NULL pointer dereference · 7bf27176
    Robert Sprowson authored
    When no drives are detected (but some are configured) CDFSSoftATAPI goes dormant by setting its private word to 0. However, when the module finalises (eg. an RMReinit) that NULL value is then used to call CD_Unregister, and attempting to free the same NULL value with OS_Module.
    Also replaced magic numbers from Hdr:ModHand and Hdr:OsBytes.
    
    Version 1.34. Tagged as 'ATAPI-1_34'
    7bf27176
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.33"
Module_Version SETA 133
Module_MajorVersion SETS "1.34"
Module_Version SETA 134
Module_MinorVersion SETS ""
Module_Date SETS "24 May 2012"
Module_ApplicationDate SETS "24-May-12"
Module_Date SETS "17 Jul 2015"
Module_ApplicationDate SETS "17-Jul-15"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.33"
Module_HelpVersion SETS "1.33 (24 May 2012)"
Module_FullVersion SETS "1.34"
Module_HelpVersion SETS "1.34 (17 Jul 2015)"
END
/* (1.33)
/* (1.34)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.33
#define Module_MajorVersion_CMHG 1.34
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 May 2012
#define Module_Date_CMHG 17 Jul 2015
#define Module_MajorVersion "1.33"
#define Module_Version 133
#define Module_MajorVersion "1.34"
#define Module_Version 134
#define Module_MinorVersion ""
#define Module_Date "24 May 2012"
#define Module_Date "17 Jul 2015"
#define Module_ApplicationDate "24-May-12"
#define Module_ApplicationDate "17-Jul-15"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.33"
#define Module_HelpVersion "1.33 (24 May 2012)"
#define Module_LibraryVersionInfo "1:33"
#define Module_FullVersion "1.34"
#define Module_HelpVersion "1.34 (17 Jul 2015)"
#define Module_LibraryVersionInfo "1:34"
......@@ -1898,7 +1898,7 @@ ALU_HackLockFlag
; Get the address of ADFS workspace
MOV r0, # 18 ; Look-up module name reason code
MOV r0, #ModHandReason_LookupName
ADR r1, ALU_ADFS
SWI XOS_Module
......
......@@ -46,6 +46,7 @@
GET hdr:ADFS
GET hdr:MsgTrans
GET hdr:ModHand
GET hdr:OsBytes
GET hdr:HostFS
......
......@@ -112,7 +112,7 @@ Module_InitialisingCode ROUT
MySTRIM "Claim space"
DisplayNewLine
MOV r0, # 6
MOV r0, #ModHandReason_Claim
LDR r3, = SizeOfWorkSpace
SWI XOS_Module
......@@ -236,7 +236,7 @@ clear_workspace
; first determine how many drives are configured so we can stop looking when
; we've found that many
MOV r0,#161 ; read CMOS
MOV r0,#OsByte_ReadCMOS
MOV r1,#CDROMFSCMOS ; location to read
SWI XOS_Byte
BVS MIC_NoDrivesFound ; if error, no drives
......@@ -501,6 +501,8 @@ FreeWorkspace ROUT
;***********************************************************************************************
LDR r2, [ r12 ]
TEQ r2, #0
MOVEQ pc, r14 ; Already unregistered and free'd earlier
MOV r6, r14
......@@ -517,7 +519,7 @@ FreeWorkspace ROUT
;---------------------------------------------------------------------------
; Free workspace - don't report an error 'cause that really screws things up
;---------------------------------------------------------------------------
MOV r0, #7
MOV r0, #ModHandReason_Free
SWI XOS_Module
SUBS r0, r0, r0 ; Set private word to 0 so that Kernel doesn't try to free it again!
......