size_t changes for multibyte characters; fix for running debug trap in asynchronous pipeline; remove support for precomputed cache files for cross-compiling; more size_t and ssize_t changes to avoid overflow

This commit is contained in:
Chet Ramey
2024-06-28 14:16:29 -04:00
parent ad1f497a84
commit 5e28a1813c
20 changed files with 145 additions and 98 deletions
+4 -4
View File
@@ -106,8 +106,7 @@ sh_modcase (const char *string, char *pat, int flags)
#if defined (HANDLE_MULTIBYTE)
wchar_t nwc;
char mb[MB_LEN_MAX+1];
int mlen;
size_t m;
size_t m, mlen;
mbstate_t state;
#endif
@@ -249,8 +248,9 @@ singlebyte:
else
{
mlen = wcrtomb (mb, nwc, &state);
if (mlen > 0)
mb[mlen] = '\0';
if (MB_INVALIDCH (mlen))
strncpy (mb, string + start, mlen = m);
mb[mlen] = '\0';
/* Don't assume the same width */
strncpy (ret + retind, mb, mlen);
retind += mlen;
+3 -1
View File
@@ -38,7 +38,9 @@ extern int errno;
int
zwrite (int fd, char *buf, size_t nb)
{
int n, i, nt;
int nt;
size_t n;
ssize_t i;
for (n = nb, nt = 0;;)
{