#86 fs_set_fpos() fails to mask off ioPosMode

open
nobody
None
5
2013-01-11
2008-04-08
Kelvin Delbarre
No

In extfs.cpp, fs_set_fpos() switches on (ReadMacInt16(pb + ioPosMode)), failing to mask off the irrelevant bits of ioPosMode as is done elsewhere in that source file.

As explained at <http://developer.apple.com/DOCUMENTATION/mac/Files/Files-116.html>, bits 4-7 of ioPosMode might be set, in which case the switch would fall through the default case without changing the file position.

The fix is:

---------
@@ -1800,7 +1800,7 @@
return fnOpnErr;

// Set file position
- switch (ReadMacInt16(pb + ioPosMode)) {
+ switch (ReadMacInt16(pb + ioPosMode) & 3) {
case fsFromStart:
if (lseek(fd, ReadMacInt32(pb + ioPosOffset), SEEK_SET) < 0)
return posErr;
---------

Discussion

  • Logged In: NO

    This fix has been delivered into CVS.