You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the url buffer size is calculated above in such a way that there is a guarantee that it's big enough for this concatenation.
This type of GCC warning is a bit bogus.
However, I think with a slight change the code here can be made better/safer and at the same time the global suppression of this warning can be removed.
Although it's not very obvious (IMO) from the man page of strncat, the last size_t argument is supposed to specify the remaining space in the destination buffer.
So, I think this code is better written as:
The proposed code looks good, and I'm +1 on removing the suppression. I'd go with ink_strlcat because use of strncat isn't common in ATS codebase. Would you make a Pull Request?
Hi there,
As far as I checked the only place where this warning is raised is here:
Here is the code in question:
Note that the
url
buffer size is calculated above in such a way that there is a guarantee that it's big enough for this concatenation.This type of GCC warning is a bit bogus.
However, I think with a slight change the code here can be made better/safer and at the same time the global suppression of this warning can be removed.
Although it's not very obvious (IMO) from the man page of
strncat
, the lastsize_t
argument is supposed to specify the remaining space in the destination buffer.So, I think this code is better written as:
or
What do you think?
The text was updated successfully, but these errors were encountered: