Memory protection for lower 16K
Tony van der Hoff
tony at mk-net.demon.co.uk
Wed Feb 13 15:31:09 GMT 2002
On 13 Feb 2002, in message <60c02e84b%Marco at dionin.esw-heim.tu-clausthal.de>,
Marco Baye <Marco.Baye at tu-clausthal.de> wrote:
> Hi!
>
> Yesterday I learned something that may be of interest for all who
> program in C under RISC OS.
>
> As you will know, the lower 16K of memory are a system area, and no
> user program should mess with it (and the other 16K before the
> application area starts are "scratch space". Whatever).
>
> Anyway, the OS does not use memory protection in these lower 16K, so
> if a C program uses an uninitialised or NULL pointer for write
> access, it is likely to corrupt something valuable.
>
Personally, I don't think that's correct. the amount of protection depends a
bit on the OS version, but I'm pretty sure RO 4 does protect the system
workspace.
[snip]
>
> char* tmpnam(char*);
>
> accesses memory location &FE8 in user mode.
Yes, RO 4 knows about this, and works round it. The 32-bit scl actually fixes
the problem.
I may be wrong on both counts, though, and I think this subject is best aired
on csap; your audience here is really too small.
A Google at csa* for "tmpnam" reveals quite a number of hits; some of them
relevant.
[snip]
--
Tony van der Hoff | MailTo:tony at mk-net.demon.co.uk
| MailTo:avanderhoff at iee.org
Buckinghamshire, England | http:www.mk-net.demon.co.uk
More information about the oslib-user
mailing list