Skip to content

lib: reject files.plist entries without the keys we read - #711

Open
safa-rk wants to merge 1 commit into
void-linux:masterfrom
safa-rk:files-plist-missing-keys
Open

safa-rk wants to merge 1 commit into
void-linux:masterfrom
safa-rk:files-plist-missing-keys

Conversation

@safa-rk

@safa-rk safa-rk commented Nov 25, 2026

Copy link
Copy Markdown

xbps_dictionary_get_cstring_nocopy() leaves its out pointer untouched when the key is absent or is not a string, and collect_files, xbps_entry_is_a_conf_file, xbps_entry_install_conf_file and file_hash_dictionary all ignore the return value. the dictionary they walk is ./files.plist read straight out of a binary package archive, so an entry without a "file" key leaves them to strcmp/snprintf an uninitialized stack pointer. to see it: build a package with xbps-create --compression none, rename the file keys in its files.plist (the replacement has the same length, so the uncompressed tar stays valid), reindex and install it. valgrind reports Invalid read of size 1 ... 0 bytes inside a block of size 80 free'd in collect_file via addItem, and the install still succeeds, recording whatever that stale proplib buffer spelled as the package's file list. packages from a local repository are only checked against the sha256 in that repository's own repodata, so the index and the archive come from the same place. a malformed entry is now EINVAL in collect_files and skipped in the conf file and hash lookups, which leaves valid packages untouched. the new install_test case asserts the rejection and fails on the unpatched tree.

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.

1 participant