Skip to content

lib/util_path.c: guard fromp before decrementing in xbps_path_rel - #712

Open
hakuxyz wants to merge 1 commit into
void-linux:masterfrom
hakuxyz:fix-path-rel-underflow
Open

hakuxyz wants to merge 1 commit into
void-linux:masterfrom
hakuxyz:fix-path-rel-underflow

Conversation

@hakuxyz

@hakuxyz hakuxyz commented Dec 2, 2026

Copy link
Copy Markdown

Fixes #663.

Avoid decrementing fromp before frombuf in xbps_path_rel when fromp is already at the start of the buffer, preventing a stack buffer underflow on short inputs like from="A" and to="B".

Added a regression test in tests/xbps/libxbps/util_path/main.c and verified with kyua and ASan/UBSan.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stack buffer underflow (read) in xbps_path_rel

1 participant