GNU bug report logs - #79336
[PATCH] df: fix potential null pointer dereference

Previous Next

Package: coreutils;

Reported by: yubiao hu <huyubiaox <at> gmail.com>

Date: Fri, 29 Aug 2025 01:47:02 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Full log


View this message in rfc822 format

From: Collin Funk <collin.funk1 <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 79336 <at> debbugs.gnu.org, yubiao hu <huyubiaox <at> gmail.com>
Subject: bug#79336: [PATCH] df: fix potential null pointer dereference
Date: Sat, 30 Aug 2025 11:07:51 -0700
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> On 2025-08-28 18:45, yubiao hu wrote:
>> * src/df.c (get_dev): Fix potential null pointer dereference
>> - Avoid dereferencing stat_file when both device and
>>   mount_point are NULL
>> - Handle allocation failure for cell when mount_point
>>   is NULL
>
> Why is this patch needed? Can you give an example df invocation in
> which mount_point is null there? As far as I can see, that cannot
> happen.

That was my understanding as well. Since preceding that section there
is:

    /* If MOUNT_POINT is null, then the file system is not mounted, and this
       program reports on the file system that the special file is on.
       It would be better to report on the unmounted file system,
       but statfs doesn't do that on most systems.  */
    if (!stat_file)
      stat_file = mount_point ? mount_point : device;

I don't see why we would have a mount entry if both MOUNT_POINT and
DEVICE are NULL.

Collin




This bug report was last modified 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.