This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Faster strn?cat


Ondrej Bilka <neleai@seznam.cz> writes:

>  char *
> -STRNCAT (char *s1, const char *s2, size_t n)
> +STRNCAT (char *d, const char *s, size_t n)
>  {

[...]

> +	return 	strncpy(d+strlen(d),s,n);
>  }

Returns the wrong value; should return d always.
Does not append a null character if strlen(s) >= n.
Appends too many null characters if strlen(s) + 1 < n.

It seems test_strncat in string/tester.c should have detected
these errors.  Did you run the test suite?

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]