]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
libfrog: fix buffer overflow in getparents path_to_string
authorDarrick J. Wong <djwong@kernel.org>
Thu, 11 Jun 2026 14:05:06 +0000 (07:05 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 17 Jun 2026 10:49:27 +0000 (12:49 +0200)
commit359eeef71fae8d5f6fcb734e6956554964025467
treebc3937a3f8472f372942ad625b6713632b846e77
parent5556c32a0304984854c11747c801be95034e5557
libfrog: fix buffer overflow in getparents path_to_string

Codex points out rather indirectly that snprintf returns the number of
bytes that would be formatted into the buffer excluding the null
terminator.  However, it won't format more bytes than the size
parameter, so the proper way to detect overflows is to compare the
return value against the size parameter.  Fix that.

Cc: linux-xfs@vger.kernel.org # v6.10.0
Fixes: 56f6ba21e97756 ("libfrog: add parent pointer support code")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
libfrog/getparents.c