]> git.ipfire.org Git - thirdparty/systemd.git/commit
sysupdate: Ensure that end of the MatchPattern is matched correctly
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 30 Apr 2026 18:27:43 +0000 (20:27 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 May 2026 16:21:55 +0000 (18:21 +0200)
commit4ffb60319bcea88b09afe24736208bd0e0e03618
treeb6f81e538440cbbcf3e53936017c4ac1b6714d52
parentfc05165fce386c8cf991f18abecc5098e7261b6f
sysupdate: Ensure that end of the MatchPattern is matched correctly

An error snuck into the pattern parsing of the `MatchPattern` key in the
sysupdate transfer files. If there's two files "part1-v2.raw", and
"part1-v2.raw.tar" in the source folder, and MatchPattern="part1-@v.raw",
sysupdate will incorrectly choose "part1-v2.raw.tar" instead of
"part1-v2.raw".

While the pattern matching works perfectly fine, after the full pattern
is successfully matched to the string, we don't ensure that the string
actually ends when the pattern just did.

This means we can end up choosing a wrong file for the update, if the
filename/path happens to start with the same MatchPattern.

Fix it by ensuring the string ends after our match pattern ended.
src/sysupdate/sysupdate-pattern.c