diff options
author | Elliott Hughes <enh@google.com> | 2019-10-29 13:00:20 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2019-10-29 20:09:49 +0000 |
commit | 5b4b58aad436e6ca92cf1314794ccb878994ed91 (patch) | |
tree | 15d4a58a7eb8e6693998b3a045b5cf35f341ea7b /libc/malloc_debug/malloc_debug.cpp | |
parent | 609d6ec4162aeea66ead0e8eb2afd9b5bd4a7155 (diff) |
Take a getopt_long() patch from upstream FreeBSD.
r342757 | kevans | 2019-01-03 19:13:24 -0800 (Thu, 03 Jan 2019) | 19 lines
getopt_long(3): fix case of malformed long opt
When presented with an arg string like '-l-', getopt_long will successfully
parse out the 'l' short option, then proceed to match '--' against the first
longopts entry as it later does a strncmp with len=0. This latter bit is
arguably another bug in itself, but presumably not a practical issue as all
callers of parse_long_options are already doing the right thing (except this
one pointed out).
An opt string like '-l-' should be considered malformed and throw a bad
argument rather than behaving as if '--' were passed. It cannot possibly do
what the invoker expects, and it's probably the result of a typo (ls -l- a)
rather than any intent.
Reported by: Tony Overfield <toverfield@yahoo.com>
Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18616
Test: treehugger
Change-Id: I593713bc35d70eb1975c9d7587528f2b3f9731af
Diffstat (limited to 'libc/malloc_debug/malloc_debug.cpp')
0 files changed, 0 insertions, 0 deletions