From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7627 invoked by alias); 13 Nov 2011 00:51:29 -0000 Received: (qmail 7616 invoked by uid 22791); 13 Nov 2011 00:51:27 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_JG X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 13 Nov 2011 00:51:14 +0000 From: "jg at jguk dot org" To: glibc-bugs@sources.redhat.com Subject: [Bug libc/9819] readdir segmentation faults when passed NULL Date: Sun, 13 Nov 2011 00:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jg at jguk dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: drepper.fsp at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00032.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=9819 --- Comment #8 from Jon Grant 2011-11-13 00:51:12 UTC --- C standard specifies: "The macro NULL is defined in (and other headers) as a null pointer constant; see 7.17." It's in stddef.h, NULL is not an uninitialised value, NULL is a part of the language. It's often set by the developer, and other times it's returned by functions like fopen. For these reasons the "null pointer constant" is provided, to be checked, not to be a feature of the language that is ignored. Re read vs fread, I would have thought if(NULL == ptr) would be exactly the same 4 instruction cost that it is in the user space as kernel. If read() checking for NULL + returning error code is not standard, really it should be IMHO. Could be in the POSIX standard. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.