core: Validate that xattr names aren't empty
authorColin Walters <walters@verbum.org>
Sat, 1 Jun 2024 15:29:13 +0000 (11:29 -0400)
committerColin Walters <walters@verbum.org>
Sat, 1 Jun 2024 18:46:23 +0000 (14:46 -0400)
commite19f73248131c089d110331ba614e51c9d2c65aa
treee25a13e9c2e3d5336cb63acac622969a76439bcb
parentac6ba4392285d4f30a937fddf2963b879fe129bd
core: Validate that xattr names aren't empty

In the ostree-ext codebase the test fixture was generating xattrs
without the trailing NUL byte.  This caused confusing errors
later.  Change the dirmeta validator to catch this.

The way GVariant represents bytestrings, the trailing NUL is there
on wire/disk so it can be there in memory too, but `g_variant_get_bytestring()`
will just return an empty `""` string if actually the value
has a missing NUL.

Signed-off-by: Colin Walters <walters@verbum.org>
src/libostree/ostree-core-private.h
src/libostree/ostree-core.c
src/libostree/ostree-repo-checkout.c
src/libostree/ostree-repo-commit.c
tests/test-basic-c.c