TL; DR: Beware when using corner cases, even when perfectly conforming to the standard.
And never “optimize” code by rewriting obvious functions into a 300-lines of undocumented assembly!
First bug report: was supposed to be ran, and send useful information (stack traces et al.).
The code might have been introduced in 2013 in this commit which was to introduce a “Faster strlen on x64” – but some existing files seems to have been merged at that time.equivalent) A Secure Version Of Strcat It began with code cleanup.In httrack, there is a lot of legacy (old, dirty) code laying around.In this hypothetical case, we’re adding a string to a structure foo: buffer.
The strlcat version exists on BSD, and is a reasonable solution to mitigate this problem.The initial byte of s2 overwrites the null byte at the end of s1.