opnsense-src/lib/libc/string
Alfonso 70164d957e Fix truncation when ssize_t is larger than MAX_INT
Casting to int truncates size on some platforms, resulting swab not
copying all the data. Cast len to size_t to avoid right shifting a
signed value: we know here it's > 0, so we can safely cast it w/o losing
precision.

In addition, be more careful with signedness of char pointers and
temporaries. Downgrade tmp from unsigned long to unsigned char since
we're only reading and writing characters.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/516
2023-02-04 21:14:14 -07:00
..
bcmp.3
bcmp.c
bcopy.3
bcopy.c libc/string/bcopy.c: Use intptr_t as the copy type 2021-04-20 01:46:42 +01:00
bstring.3
bzero.3
bzero.c
ffs.3
ffs.c
ffsl.c
ffsll.c
fls.c
flsl.c
flsll.c
index.3
Makefile.inc libc: Fix build with WITHOUT_MACHDEP_OPTIMIZATIONS=YES set. 2023-01-10 17:00:41 +03:00
memccpy.3
memccpy.c
memchr.3
memchr.c clang-format libc string functions imported from musl 2020-11-18 22:01:34 +00:00
memcmp.3
memcmp.c
memcpy.3 memcpy.3: remove BUGS section allowing overlapping strings 2021-08-24 09:58:10 -04:00
memcpy.c
memmem.3
memmem.c libc: fix undefined behavior from signed overflow in strstr and memmem 2020-11-19 00:03:15 +00:00
memmove.3
memmove.c
mempcpy.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
memrchr.c
memset.3 memset.3: better fix previous typo 2020-02-08 21:17:48 +00:00
memset.c libc/string/memset.c: Use unsigned long for stores 2021-04-20 01:46:43 +01:00
memset_s.c
stpcpy.c
stpncpy.c
strcasecmp.3
strcasecmp.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
strcasestr.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
strcat.3 libc: Add HISTORY sections to the manual pages 2022-05-05 18:46:32 +02:00
strcat.c
strchr.3
strchr.c libc: Use musl's optimized strchr and strchrnul 2021-03-01 21:09:59 -05:00
strchrnul.c libc: Use musl's optimized strchr and strchrnul 2021-03-01 21:09:59 -05:00
strcmp.3 libc: Add HISTORY sections to the manual pages 2022-05-05 18:46:32 +02:00
strcmp.c
strcoll.3
strcoll.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
strcpy.3
strcpy.c
strcspn.c
strdup.3 strdup.3: Function appeared in 4.3BSD-Reno, not 4.4BSD 2020-12-14 00:50:45 +00:00
strdup.c
strerror.3 strerror.3: Fix whitespace issue introduced in r368714 2020-12-18 22:10:17 +00:00
strerror.c Remove __NO_TLS. 2021-02-23 20:08:10 +02:00
string.3
strlcat.c
strlcpy.3 libc manpages: various improvements from NetBSD 2020-06-14 05:59:30 +00:00
strlcpy.c
strlen.3 libc: Add HISTORY sections to the manual pages 2022-05-05 18:46:32 +02:00
strlen.c Restore the augmented strlen commentary 2021-02-08 19:15:21 +00:00
strmode.3
strmode.c Change strmode argument type to mode_t 2021-06-29 17:38:45 -06:00
strncat.c
strncmp.c
strncpy.c
strndup.c
strnlen.c
strnstr.c
strpbrk.3
strpbrk.c
strrchr.c
strsep.3
strsep.c
strsignal.c
strspn.3
strspn.c
strstr.3
strstr.c libc: correct SPDX tag on strstr.c 2022-01-16 11:56:28 -05:00
strtok.3 strtok(3): make it easier to find the RETURN VALUES section 2020-06-22 11:03:36 +00:00
strtok.c
strverscmp.3 libc: Add strverscmp(3) and versionsort(3) 2022-08-25 03:29:03 +03:00
strverscmp.c libc: Add strverscmp(3) and versionsort(3) 2022-08-25 03:29:03 +03:00
strxfrm.3
strxfrm.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
swab.3
swab.c Fix truncation when ssize_t is larger than MAX_INT 2023-02-04 21:14:14 -07:00
Symbol.map libc: Add strverscmp(3) and versionsort(3) 2022-08-25 03:29:03 +03:00
timingsafe_bcmp.3
timingsafe_bcmp.c
timingsafe_memcmp.c
wcpcpy.c
wcpncpy.c
wcscasecmp.c
wcscat.c
wcschr.c
wcscmp.c
wcscoll.3
wcscoll.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
wcscpy.c
wcscspn.c
wcsdup.c
wcslcat.c
wcslcpy.c
wcslen.c
wcsncasecmp.c
wcsncat.c
wcsncmp.c
wcsncpy.c
wcsnlen.c
wcspbrk.c
wcsrchr.c
wcsspn.c
wcsstr.c
wcstok.3
wcstok.c
wcswidth.3
wcswidth.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
wcsxfrm.3
wcsxfrm.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
wmemchr.3 libc: add mempcpy(3) and wmempcpy(3) 2021-07-15 19:40:28 +03:00
wmemchr.c
wmemcmp.c
wmemcpy.c
wmemmove.c
wmempcpy.c libc: drop "All rights reserved" from Foundation copyrights 2022-08-04 16:57:50 -04:00
wmemset.c