diff options
author | Johannes Heimansberg <git@jhe.dedyn.io> | 2020-09-06 09:22:50 +0200 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2020-11-27 16:40:12 -0600 |
commit | 47819f004cec3cc3e911ba69003b8b52bacbebef (patch) | |
tree | dc706fbb6f4bf1695267e7ec2cea8cff1daee100 /BUSYBOX.md | |
parent | 0fab3e837b45021fdcc02a71873c3c245ce96080 (diff) |
start-stop-daemon, supervise-daemon: fix parsing of usernames passed via --user that start with a number
start-stop-daemon and supervise-daemon parse usernames and group names
passed via the --user argument as numeric UID/GID if they start with a
number (e.g. user "4foo" will be treated as UID 4). This results in the
process that is being started to run under a totally unexpected user if
that UID exists.
Even though the result of the sscanf calls are tested for a result of
exactly 1, which means exactly one value was extracted, because sscanf's
format string only contains only one placeholder, it will never return
a value greater than 1, even if there are still characters left to be
parsed. This causes start-stop-daemon and supervise-daemon to assume
that usernames starting with a number are just that number. Adding a
second placeholder "%1s" to the format string, which matches a string of
length 1, makes sure that sscanf can distinguish between pure numbers
(in which case it will return 1) and strings either starting with a
number (in which case it will return 2) and any other string (in which
case it will return 0).
This fixes #379.
This fixes #380.
Diffstat (limited to 'BUSYBOX.md')
0 files changed, 0 insertions, 0 deletions