X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Mon, 6 Sep 2004 21:07:38 -0400 Message-Id: <200409070107.i8717c0u020207@envy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com CC: bartoldeman AT ihug DOT co DOT nz In-reply-to: (message from Bart Oldeman on Tue, 07 Sep 2004 10:43:08 +1200) Subject: Re: DJGPP's NULL pointer protection seems to violate DPMI spec References: Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk DJGPP does not violate the DPMI spec because DJGPP does not *implement* the DPMI spec. When it calls DPMI 0507 to uncommit the zero page, the DPMI server is permitted to do one of two things: 1. Uncommit the page. 2. Report an error 8023H (invalid handle). DJGPP programs will accept either of these results. If your DPMI server does anything else, your DPMI server is broken. The reason we do it this way is because 0504 is a DPMI 1.0 function so we can't rely on it being available to allocate the memory. However, if 0507 *happens* to work (which it does for CWDPMI), we get NULL protection. As for tokbot, if it doesn't run under CWSDPMI (i.e. real dos, not dosemu) but does under Windows, then it is probably dereferencing a NULL pointer, and is broken. No DJGPP program ever has a valid reason for dereferencing a NULL pointer. This is FAQ 9.1 (http://www.delorie.com/djgpp/v2faq/faq9_1.html). And no, I didn't write the DPMI spec.