]> git.ipfire.org Git - thirdparty/samba.git/commit
cmdline:burn: do not retain false memories
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 27 Jun 2024 03:20:27 +0000 (15:20 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 3 Jul 2024 01:35:31 +0000 (01:35 +0000)
commit2f6020cf3dadf484251701040e09a10fba2f644e
tree0e6fe9b2a4dcec772eef92c852dce4745aee2821
parent05128a1f5f17c55a8d8da42c6c52c4235adf36d4
cmdline:burn: do not retain false memories

If argv contains a secret option without an '=' (or in the case of
"-U", the username is separated by space), we will get to the
`if (strlen(p) == ulen) { continue; }` without resetting the found
and is_user variables. This *sometimes* has the right effect, because
the next string in argv ought to contain the secret.

But in a case like {"--password", "1234567890"}, where the secret
string is the same length as the option, we *again* take that branch
and the password is not redacted, though the argument after it will be
unless it is also of the same length.

If we always set the flags at the start we avoid this. This makes
things worse in the short term for secrets that are not the same
length as their options, but we'll get to that in another commit soon.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15674

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
lib/cmdline/cmdline.c