> 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