Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!linus!security!genrad!decvax!minow From: minow@decvax.UUCP (Martin Minow) Newsgroups: net.bugs.4bsd Subject: NULL pointer dereferencing and printf Message-ID: <352@decvax.UUCP> Date: Thu, 26-Jan-84 21:45:24 EST Article-I.D.: decvax.352 Posted: Thu Jan 26 21:45:24 1984 Date-Received: Sat, 28-Jan-84 03:20:48 EST References: <1590@rlgvax.UUCP> Organization: DEC UNIX Engineering Group Lines: 18 This discussion seems to pop up once a year -- perhaps it could be put in net.announce and be done with. You shouldn't dereference NULL. But people do -- mostly by accident. As a slight debugging aid, the Decus C printf (and, I think, the V6 printf) test for printf("%s", NULL) and print "{null}". This at least keeps the bug from being fatal. Vax-11 C crashes the program which gets the bug out quicker, I suppose. (Actually, on Vax, the first 512 bytes of the user address space can't be referenced, so most instances of ((struct foo *) NULL)->bar are caught, too. Martin Minow decvax!minow