[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c2f0053-9cd9-94aa-7b2b-7d458bd8127c@iogearbox.net>
Date: Tue, 21 May 2019 16:48:44 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Chang-Hsien Tsai <luke.tw@...il.com>, netdev@...r.kernel.org
Cc: ast@...nel.org, kafai@...com, songliubraving@...com, yhs@...com
Subject: Re: [PATCH] samples: bpf: fix: change the buffer size for read()
On 05/19/2019 11:05 AM, Chang-Hsien Tsai wrote:
> If the trace for read is larger than 4096,
> the return value sz will be 4096.
> This results in off-by-one error on buf.
>
> static char buf[4096];
> ssize_t sz;
>
> sz = read(trace_fd, buf, sizeof(buf));
> if (sz > 0) {
> buf[sz] = 0;
> puts(buf);
> }
>
> Signed-off-by: Chang-Hsien Tsai <luke.tw@...il.com>
Applied, thanks!
Powered by blists - more mailing lists