Dereferencing NULL
dbj%rice at sri-unix.UUCP
dbj%rice at sri-unix.UUCP
Thu Dec 1 12:32:43 AEST 1983
From: Dave Johnson <dbj at rice>
I don't want to start another dereferencing NULL discussion (it's a bad
idea, but too much code does it to change), but Ron Natalie's last message
contained a couple of incorrect statements that should be cleared up.
First, the different ioctl's in Unix (at least in 4.1 and System 5) are each
processed by different cases of a switch statement (one in the tty driver,
one in the tape driver in 4.1, etc). The ones that don't expect a third
argument (which can thus be zero) never reference it. They don't try to
indirect through the third argument before they find out that they don't
need it.
Also, under 4.1 at least, all the ioctl's that take a pointer to a number
for the third argument actually take an (int *). If you indirect through 0
to pick up an integer, you don't get 0, you get 14693172 or 0x08c20000.
There is a zero at address zero, but it is only 16 bits worth of zero, not a
whole integer.
Dave Johnson
Dept. of Math Science
Rice University
dbj at rice
More information about the Comp.unix.wizards
mailing list