mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
* string/strxfrm_l.c (STRXFRM): Fix trailing \1 optimization
if N is one bigger than return value. * string/tst-strxfrm2.c (do_test): Also test strxfrm with l1 + 1 and l1 last arguments, if buf is defined, verify the return value equals to strlen (buf) and verify no byte beyond passed length is modified.
This commit is contained in:
@@ -432,7 +432,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
|
||||
if (needed > 2 && needed == last_needed + 1)
|
||||
{
|
||||
/* Remove the \1 byte. */
|
||||
if (--needed < n)
|
||||
if (--needed <= n)
|
||||
dest[needed - 1] = L('\0');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user