]> git.ipfire.org Git - thirdparty/util-linux.git/commit
sys-utils: fix add NULL check for mnt_fs_get_target return value
authorAntonMoryakov <ant.v.moryakov@gmail.com>
Tue, 14 Jan 2025 15:06:49 +0000 (18:06 +0300)
committerAntonMoryakov <ant.v.moryakov@gmail.com>
Tue, 14 Jan 2025 15:07:21 +0000 (18:07 +0300)
commit0fabec8c7fda554b79327d8713352e7a07539895
tree28208140a0a7636cc970525e6af2668be1860f80
parent23901d227c6e948a9f3a413a5f3e0ca41bc8f8fa
sys-utils: fix add NULL check for mnt_fs_get_target return value

The static analyzer flagged a potential issue: the return value of
mnt_fs_get_target(fs) could be NULL, but it was dereferenced without
a check. This could lead to undefined behavior.

Added a NULL check before using the tgt pointer. If tgt is NULL,
the current iteration is skipped.

ChanChanges:
- Added if (!tgt) check before using tgt.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
sys-utils/lsns.c