Re: [PATCH bpf-next] bpftool: Fix readlink usage in get_fd_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2025-01-29 08:18 UTC+0100 ~ Viktor Malik <vmalik@xxxxxxxxxx>
> The `readlink(path, buf, sizeof(buf))` call reads at most sizeof(buf)
> bytes and *does not* append null-terminator to buf. With respect to
> that, fix two pieces in get_fd_type:
> 
> 1. Change the truncation check to contain sizeof(buf) rather than
>    sizeof(path).
> 2. Append null-terminator to buf.
> 
> Reported by Coverity.
> 
> Signed-off-by: Viktor Malik <vmalik@xxxxxxxxxx>

Nice, thank you!

Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Reviewed-by: Quentin Monnet <qmo@xxxxxxxxxx>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux