]> git.proxmox.com Git - mirror_iproute2.git/commit
ss: fix crash when skipping disabled header field
authorAntonio Quartulli <a@unstable.cc>
Sat, 6 Jan 2018 18:31:49 +0000 (02:31 +0800)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 9 Jan 2018 16:02:46 +0000 (08:02 -0800)
commit192be8fccbdd752f37afc31ee0fa806a662bb9dd
treefcfa30fd7e54343d093f810ddd9c627fece06f5d
parent33f6dd23a51c4ed5afbf161317c8d01f003f2c2a
ss: fix crash when skipping disabled header field

When the first header field is disabled (i.e. when passing the -t
option), field_flush() is invoked with the `buffer` global variable
still zero'd.
However, in field_flush() we try to access buffer.cur->len
during variables initialization, thus leading to a SIGSEGV.

It's interesting to note that this bug appears only when the code
is compiled with -O0, because the compiler is smart
enough to immediately jump to the return statement if optimizations
are enabled and skip the faulty instruction.

Cc: Stefano Brivio <sbrivio@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/ss.c