]> git.ipfire.org Git - thirdparty/systemd.git/commit
hostnamed: when parsing day/month of firmware date, force decimal parsing 28080/head
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Jun 2023 13:00:07 +0000 (15:00 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Jun 2023 13:18:58 +0000 (15:18 +0200)
commit7dad6de158cbc280988efa9e52e6d2b9c840ea9f
tree20e674bbcb2df3f87aef716a0af7fb5bead87fb7
parentc65c2f0aa6b72efc12ebdb5cac0ac24881c272c5
hostnamed: when parsing day/month of firmware date, force decimal parsing

safe_atou() by default determines the base from the prefix 0x, 0b, 0o
and for compat with just 0 for octal. This is not what we want here,
since the date components are padded with zeroes yet still decimal.
Hence force decimal parsing (and while we are at it, prohibit a couple
of unexpected decorations).

WIthout this we'd fail to parse any the 8th and 9th day of each months, as
well aus aug and september of every year, because these look like octal
numbers but cannot actually parsed as such.

Let's change the testcase to check for a date that exposes this
bheaviour.
src/hostname/hostnamed.c
test/units/testsuite-71.sh