mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-11-02 20:52:07 +00:00
ss: fix NULL dereference when rendering without header
When ss is invoked with the no-header flag, if the query doesn't return any result, render() is called with 'buffer' uninitialized. This currently leads to a segfault. Ensure that buffer is initialized before rendering. The bug can be triggered with: ss -H sport = 100000 Signed-off-by: Jean-Philippe Brucker <jphilippe.brucker@gmail.com> Acked-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
3dec72672f
commit
eb8559eff1
@ -1197,10 +1197,15 @@ newline:
|
||||
/* Render buffered output with spacing and delimiters, then free up buffers */
|
||||
static void render(int screen_width)
|
||||
{
|
||||
struct buf_token *token = (struct buf_token *)buffer.head->data;
|
||||
struct buf_token *token;
|
||||
int printed, line_started = 0;
|
||||
struct column *f;
|
||||
|
||||
if (!buffer.head)
|
||||
return;
|
||||
|
||||
token = (struct buf_token *)buffer.head->data;
|
||||
|
||||
/* Ensure end alignment of last token, it wasn't necessarily flushed */
|
||||
buffer.tail->end += buffer.cur->len % 2;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user