]> git.proxmox.com Git - iproute2.git/blame - debian/patches/0099-fix-ss-no-header-renderer.patch
Update to 4.15, fix /bin/ss with no header flag
[iproute2.git] / debian / patches / 0099-fix-ss-no-header-renderer.patch
CommitLineData
6a1a5031
RJ
1When ss is invoked with the no-header flag, if the query doesn't return
2any result, render() is called with 'buffer' uninitialized. This
3currently leads to a segfault. Ensure that buffer is initialized before
4rendering.
5
6The bug can be triggered with: ss -H sport = 100000
7
8Signed-off-by: Jean-Philippe Brucker <jphilippe.brucker@xxxxxxxxx>
9---
10 misc/ss.c | 7 ++++++-
11 1 file changed, 6 insertions(+), 1 deletion(-)
12
13diff --git a/misc/ss.c b/misc/ss.c
14index e047f9c0..e087bef7 100644
15--- a/misc/ss.c
16+++ b/misc/ss.c
17@@ -1197,10 +1197,15 @@ newline:
18 /* Render buffered output with spacing and delimiters, then free up buffers */
19 static void render(int screen_width)
20 {
21- struct buf_token *token = (struct buf_token *)buffer.head->data;
22+ struct buf_token *token;
23 int printed, line_started = 0;
24 struct column *f;
25
26+ if (!buffer.head)
27+ return;
28+
29+ token = (struct buf_token *)buffer.head->data;
30+
31 /* Ensure end alignment of last token, it wasn't necessarily flushed */
32 buffer.tail->end += buffer.cur->len % 2;
33
34--
352.16.2