summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2023-04-07 10:32:07 +0200
committerMike Yuan <me@yhndnzj.com>2023-04-07 18:08:43 +0200
commitb24b10592d74b73529817813ff33f7e28e79ca41 (patch)
treed623173badba11d251005bda18fefc19baafdd55 /src/udev/udev-rules.c
parentman/systemd-mount: Clearify documentation about --bind-device (diff)
downloadsystemd-b24b10592d74b73529817813ff33f7e28e79ca41.tar.xz
systemd-b24b10592d74b73529817813ff33f7e28e79ca41.zip
localed: fix invalid free after shifting pointers using strstrip
After manually editing /etc/locale.gen, calling localectl set-locale sometimes fails. When it fails, the systemd journal shows: systemd-localed: free() / invalid pointer. It turned out that it only fails if some of the uncommented lines in /etc/locale.gen have leading spaces, as in: * C.UTF-8 <= OK * en_US.UTF-8 <= OK * fr_FR.UTF-8 <= NOK After parsing a line from /etc/locale.gen, we use strstrip() to obtain the "trimmed" line (without leading or trailing spaces). However, we store the result of strstrip() in the original pointer containing the untrimmed line. This pointer is later passed to free (this is done automatically using _cleanup_free_). This is a problem because if any leading space is present, the pointer will essentially be shifted from its original value. This will result in an invalid free upon cleanup. The same issue is present in the locale_gen_locale_supported function. Fixed by storing the result of strstrip() in a different pointer.
Diffstat (limited to 'src/udev/udev-rules.c')
0 files changed, 0 insertions, 0 deletions