utils: Fix strlcat() implementation
Existing strlcat() implementation failed to concatenate a source buffer
with the destination buffer, when the destination buffer has valid
buffer length.
For example,
input str1: "sigma"
input str2: "dut"
Expected result: "sigmadut"
Observed result: "sigma"
If the destination buffer is valid, we are only returning the combined
length instead of copying the source buffer to the destination buffer.
Fix this by checking the destination length against the size parameter
and copying the source buffer to the destination buffer if the size
exceeds destination buffer length.
Co-developed-by: Sathishkumar Muruganandam <murugana@codeaurora.org>
Signed-off-by: Sathishkumar Muruganandam <murugana@codeaurora.org>
Signed-off-by: P Praneesh <ppranees@codeaurora.org>
1 file changed