RE: [PATCH] tools/bpf/bpftool: fix buffer handling in get_fd_type()

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

 



> Hi and thanks, but I don't understand the change. On success, readlink() 
> returns the number of bytes placed in the buffer, which is at most
> sizeof(buf) in our case, given that it silently truncates the string if 
> the buffer is too small. So we can never have "n > sizeof(buf)" here?
> The current code looks correct to me.
>
> Did you actually hit the buffer overflow you describe?

Hi Quentin,

Thank you for the review. You're absolutely right.
I apologize for the confusion in my commit message.

Looking at the code more carefully, I realize the current check is actually 
correct for the overflow detection. The real issue I was trying to address 
is that when n == sizeof(buf), there's no space for null termination. Which is already taken care.

BR,
Kaushlendra




[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