The klibc strncat doesnt behave like described in the man page.
It doesnt terminate the string if size < strlen(src).
It doesnt make dst longer than size.

#include <string.h>
#include <stdio.h>
int main(void)
{
        unsigned char olh[42];
        memset(olh, 'A', sizeof(olh));
        sprintf(olh, "abc");
        fprintf(stderr, "olh: '%s'\n", olh);
        bar(olh, "123456789", 7);
        fprintf(stderr, "olh: '%s'\n", olh);
  return 0;
}

olh: 'abc'
olh: 'abc1234AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'

1 file changed