delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/06/19/12:15:23

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <9706191558.AA14263@clio.rice.edu>
Subject: Re: Possible misbehavior of write
To: dj AT delorie DOT com (DJ Delorie)
Date: Thu, 19 Jun 1997 10:58:57 -0600 (CDT)
Cc: djgpp-workers AT delorie DOT com
In-Reply-To: <199706191101.HAA29378@delorie.com> from "DJ Delorie" at Jun 19, 97 07:01:38 am

> I think checking for pointers in the 0..4095 range would be worth it,
> but trying to handle all those other cases would be too much overhead,
> considering how long it's taken for it to become an issue.

Since most DPMI providers don't allow the null page protection, this is
probably a good idea.  But I would define a macro like "if (_djbadptr(ptr))"
so if we decided to enhance/change/suppress it later, it's a change to a single
include file.  Something like:

#define _djbadptr(ptr) (ptr < 0x10a8)

>   if (_djbadptr(ptr))
>   {
>     errno = EFAULT;
>     return -1;
>   }

Other possibilities
#define _djbadptr(ptr) 0
#define _djbadptr(ptr) ((ptr < 0x10a8) || ptr > sbrk(0))
extern int _djbadptr();

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019