bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#79336: [PATCH] df: fix potential null pointer dereference


From: Collin Funk
Subject: bug#79336: [PATCH] df: fix potential null pointer dereference
Date: Sat, 30 Aug 2025 11:07:51 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Paul Eggert <eggert@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]