mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 21:50:14 +02:00
* Fixed crash in DiskFree() and DiskSize() on Unices due to out of bound read of the DriveStr[] array in rare cases.
git-svn-id: trunk@39866 -
This commit is contained in:
parent
212eca24d1
commit
5e92e2d23f
@ -1134,7 +1134,7 @@ var
|
||||
fs : tstatfs;
|
||||
Begin
|
||||
if ((Drive in [Low(FixDriveStr)..High(FixDriveStr)]) and (not (fixdrivestr[Drive]=nil)) and (fpstatfs(StrPas(fixdrivestr[drive]),@fs)<>-1)) or
|
||||
((Drive <= High(drivestr)) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
|
||||
((Drive in [Low(DriveStr)..High(DriveStr)]) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
|
||||
Diskfree:=int64(fs.bavail)*int64(fs.bsize)
|
||||
else
|
||||
Diskfree:=-1;
|
||||
@ -1147,7 +1147,7 @@ var
|
||||
fs : tstatfs;
|
||||
Begin
|
||||
if ((Drive in [Low(FixDriveStr)..High(FixDriveStr)]) and (not (fixdrivestr[Drive]=nil)) and (fpstatfs(StrPas(fixdrivestr[drive]),@fs)<>-1)) or
|
||||
((drive <= High(drivestr)) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
|
||||
((Drive in [Low(DriveStr)..High(DriveStr)]) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
|
||||
DiskSize:=int64(fs.blocks)*int64(fs.bsize)
|
||||
else
|
||||
DiskSize:=-1;
|
||||
|
Loading…
Reference in New Issue
Block a user