Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ac86e10
Fix compiler warning with GCC 16: variable 'offset' set but not used …
arnaud-lb May 5, 2026
6a27514
Fix compiler warning with glibc 2.43 support of C23 const-preserving …
arnaud-lb May 5, 2026
33caad7
Fix bad merge
arnaud-lb May 6, 2026
45d9684
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
72cbc1f
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
aee3b3a
GHSA-85c2-q967-79q5: [soap] Fix stale SOAP_GLOBAL(ref_map) pointer wi…
iluuu1994 May 3, 2026
db2a7f9
GHSA-m33r-qmcv-p97q: [soap] Fix use-after-free after header parsing f…
iluuu1994 May 3, 2026
79551ab
GHSA-hmxp-6pc4-f3vv: [soap] Fix broken Apache map value NULL check
iluuu1994 Apr 24, 2026
99a5ad7
GHSA-7qg2-v9fj-4mwv: [fpm] XSS within status endpoint
bukka May 3, 2026
79a054e
GHSA-wm6j-2649-pv75: [mbstring] Fix null pointer dereference in php_m…
vi3tL0u1s May 3, 2026
86bb29d
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 May 6, 2026
a2ee688
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 May 6, 2026
9db4c1a
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
257cb3a
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
3f40b65
GHSA-w476-322c-wpvm: [pdo_firebird] Fix SQL injection via NUL bytes i…
SakiTakamachi May 3, 2026
0842621
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 May 6, 2026
4cf8fb3
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 May 6, 2026
a02c0ce
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
3e57595
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
47def8c
GHSA-96wq-48vp-hh57: [metaphone] Fix signed integer overflow of char …
TimWolla May 3, 2026
411c0de
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 May 6, 2026
f5d445e
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 May 6, 2026
3f6f38b
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
63dcfb4
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
a384187
GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h funct…
iluuu1994 May 3, 2026
398b7da
GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h funct…
iluuu1994 May 6, 2026
dc9e21b
GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h funct…
iluuu1994 May 6, 2026
b8dad93
GHSA-m8rr-4c36-8gq4: Consistently pass unsigned char to ctype.h funct…
iluuu1994 May 6, 2026
529b145
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
56ee76f
GHSA-74r9-qxhc-fx53: [mbstring] Fix out-of-bounds access in mbfl_name…
iluuu1994 May 3, 2026
f30cb44
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
388f307
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
72e3d85
Fix mbstring test with oniguruma deprecation
iluuu1994 May 6, 2026
887e649
[skip ci] Add NEWS entries for 8.2.31 security issues
saundefined May 5, 2026
5f5245c
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 May 6, 2026
e77f582
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 May 6, 2026
7596239
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
d056b6e
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
e9e41af
PHP-8.2 is now for PHP 8.2.32-dev
saundefined May 6, 2026
e754e7d
Merge branch 'PHP-8.2' into PHP-8.3
saundefined May 6, 2026
80f0661
Merge branch 'PHP-8.3' into PHP-8.4
saundefined May 6, 2026
3ef978f
Merge branch 'PHP-8.4' into PHP-8.5
saundefined May 6, 2026
242fee9
Merge branch 'PHP-8.5'
saundefined May 6, 2026
fee84dd
[skip ci] Adjust credits for GHSA-96wq-48vp-hh57.phpt
iluuu1994 May 6, 2026
cbf6598
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 May 6, 2026
14f2071
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 May 6, 2026
0017e9b
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 May 6, 2026
0173ef4
Merge branch 'PHP-8.5'
iluuu1994 May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Zend/tests/GHSA-wm6j-2649-pv75.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
GHSA-wm6j-2649-pv75: Null pointer dereference in php_mb_check_encoding() via mb_ereg_search_init()
--CREDITS--
vi3tL0u1s
--EXTENSIONS--
mbstring
--SKIPIF--
<?php
if (!function_exists('mb_regex_encoding')) die('skip No mbregex support');
?>
--FILE--
<?php
// iso-8859-11 is supported by Oniguruma but not by mbfl
mb_regex_encoding('iso-8859-11');
mb_ereg_search_init('x');
?>
--EXPECTF--
Deprecated: Function mb_regex_encoding() is deprecated since 8.6, because the underlying library is no longer maintained in %s on line %d

Fatal error: Uncaught ValueError: mb_regex_encoding(): Argument #1 ($encoding) must be a valid encoding, "iso-8859-11" given in %s:%d
Stack trace:
#0 %s(%d): mb_regex_encoding('iso-8859-11')
#1 {main}
thrown in %s on line %d
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ ZEND_API size_t zend_dirname(char *path, size_t len)
/* Note that on Win32 CWD is per drive (heritage from CP/M).
* This means dirname("c:foo") maps to "c:." or "c:" - which means CWD on C: drive.
*/
if ((2 <= len) && isalpha((int)((unsigned char *)path)[0]) && (':' == path[1])) {
if ((2 <= len) && isalpha((unsigned char)path[0]) && (':' == path[1])) {
/* Skip over the drive spec (if any) so as not to change */
path += 2;
len_adjust += 2;
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ static const char *zend_ini_consume_quantity_prefix(const char *const digits, co
++digits_consumed;
}

if (digits_consumed[0] == '0' && !isdigit(digits_consumed[1])) {
if (digits_consumed[0] == '0' && !isdigit((unsigned char)digits_consumed[1])) {
/* Value is just 0 */
if ((digits_consumed+1) == str_end) {
return digits_consumed;
Expand Down Expand Up @@ -642,7 +642,7 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen
}

/* if there is no digit after +/- */
if (!isdigit(digits[0])) {
if (!isdigit((unsigned char)digits[0])) {
/* Escape the string to avoid null bytes and to make non-printable chars
* visible */
smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value));
Expand All @@ -656,7 +656,7 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen
}

int base = 0;
if (digits[0] == '0' && !isdigit(digits[1])) {
if (digits[0] == '0' && !isdigit((unsigned char)digits[1])) {
/* Value is just 0 */
if ((digits+1) == str_end) {
*errstr = NULL;
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -3321,8 +3321,8 @@ ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp_l(const char *s1, size_t len1,

len = MIN(len1, len2);
while (len--) {
c1 = zend_tolower((int)*(unsigned char *)s1++);
c2 = zend_tolower((int)*(unsigned char *)s2++);
c1 = zend_tolower((unsigned char)*(s1++));
c2 = zend_tolower((unsigned char)*(s2++));
if (c1 != c2) {
return c1 - c2;
}
Expand All @@ -3342,8 +3342,8 @@ ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1
}
len = MIN(length, MIN(len1, len2));
while (len--) {
c1 = zend_tolower((int)*(unsigned char *)s1++);
c2 = zend_tolower((int)*(unsigned char *)s2++);
c1 = zend_tolower((unsigned char)*(s1++));
c2 = zend_tolower((unsigned char)*(s2++));
if (c1 != c2) {
return c1 - c2;
}
Expand Down
10 changes: 5 additions & 5 deletions Zend/zend_virtual_cwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void virtual_cwd_main_cwd_init(uint8_t reinit) /* {{{ */
main_cwd_state.cwd_length = strlen(cwd);
#ifdef ZEND_WIN32
if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') {
cwd[0] = toupper(cwd[0]);
cwd[0] = toupper((unsigned char)cwd[0]);
}
#endif
main_cwd_state.cwd = strdup(cwd);
Expand Down Expand Up @@ -269,7 +269,7 @@ CWD_API char *virtual_getcwd_ex(size_t *length) /* {{{ */
*length = state->cwd_length+1;
retval = (char *) emalloc(*length+1);
memcpy(retval, state->cwd, *length);
retval[0] = toupper(retval[0]);
retval[0] = toupper((unsigned char)retval[0]);
retval[*length-1] = DEFAULT_SLASH;
retval[*length] = '\0';
return retval;
Expand Down Expand Up @@ -1112,21 +1112,21 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
if (resolved_path[start] == 0) {
goto verify;
}
resolved_path[start] = toupper(resolved_path[start]);
resolved_path[start] = toupper((unsigned char)resolved_path[start]);
start++;
}
resolved_path[start++] = DEFAULT_SLASH;
while (!IS_SLASH(resolved_path[start])) {
if (resolved_path[start] == 0) {
goto verify;
}
resolved_path[start] = toupper(resolved_path[start]);
resolved_path[start] = toupper((unsigned char)resolved_path[start]);
start++;
}
resolved_path[start++] = DEFAULT_SLASH;
} else if (IS_ABSOLUTE_PATH(resolved_path, path_length)) {
/* skip DRIVE name */
resolved_path[0] = toupper(resolved_path[0]);
resolved_path[0] = toupper((unsigned char)resolved_path[0]);
resolved_path[2] = DEFAULT_SLASH;
if (path_length == 2) {
resolved_path[3] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_virtual_cwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef unsigned short mode_t;
#define IS_UNC_PATH(path, len) \
(len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
#define IS_ABSOLUTE_PATH(path, len) \
(len >= 2 && (/* is local */isalpha(path[0]) && path[1] == ':' || /* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1])))
(len >= 2 && (/* is local */isalpha((unsigned char)(path)[0]) && path[1] == ':' || /* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1])))

#else
#ifdef HAVE_DIRENT_H
Expand Down
4 changes: 2 additions & 2 deletions ext/com_dotnet/com_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
}

/* Remove leading/training white spaces on search_string */
while (isspace(*typelib_name)) {/* Ends on '\0' in worst case */
while (isspace((unsigned char)*typelib_name)) {/* Ends on '\0' in worst case */
typelib_name ++;
}
ptr = typelib_name + strlen(typelib_name) - 1;
while ((ptr != typelib_name) && isspace(*ptr)) {
while ((ptr != typelib_name) && isspace((unsigned char)*ptr)) {
*ptr = '\0';
ptr--;
}
Expand Down
6 changes: 3 additions & 3 deletions ext/date/lib/parse_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ static timelib_sll timelib_get_nr(const char **ptr, int max_length)

static void timelib_skip_day_suffix(const char **ptr)
{
if (isspace(**ptr)) {
if (isspace((unsigned char)**ptr)) {
return;
}
if (!timelib_strncasecmp(*ptr, "nd", 2) || !timelib_strncasecmp(*ptr, "rd", 2) ||!timelib_strncasecmp(*ptr, "st", 2) || !timelib_strncasecmp(*ptr, "th", 2)) {
Expand Down Expand Up @@ -859,7 +859,7 @@ static timelib_long timelib_parse_tz_cor(const char **ptr, int *tz_not_found)

*tz_not_found = 1;

while (isdigit(**ptr) || **ptr == ':') {
while (isdigit((unsigned char)**ptr) || **ptr == ':') {
++*ptr;
}
end = *ptr;
Expand Down Expand Up @@ -924,7 +924,7 @@ static timelib_long timelib_parse_tz_minutes(const char **ptr, timelib_time *t)
}

++*ptr;
while (isdigit(**ptr)) {
while (isdigit((unsigned char)**ptr)) {
++*ptr;
}

Expand Down
6 changes: 3 additions & 3 deletions ext/date/lib/parse_date.re
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ static timelib_sll timelib_get_nr(const char **ptr, int max_length)

static void timelib_skip_day_suffix(const char **ptr)
{
if (isspace(**ptr)) {
if (isspace((unsigned char)**ptr)) {
return;
}
if (!timelib_strncasecmp(*ptr, "nd", 2) || !timelib_strncasecmp(*ptr, "rd", 2) ||!timelib_strncasecmp(*ptr, "st", 2) || !timelib_strncasecmp(*ptr, "th", 2)) {
Expand Down Expand Up @@ -857,7 +857,7 @@ static timelib_long timelib_parse_tz_cor(const char **ptr, int *tz_not_found)

*tz_not_found = 1;

while (isdigit(**ptr) || **ptr == ':') {
while (isdigit((unsigned char)**ptr) || **ptr == ':') {
++*ptr;
}
end = *ptr;
Expand Down Expand Up @@ -922,7 +922,7 @@ static timelib_long timelib_parse_tz_minutes(const char **ptr, timelib_time *t)
}

++*ptr;
while (isdigit(**ptr)) {
while (isdigit((unsigned char)**ptr)) {
++*ptr;
}

Expand Down
4 changes: 2 additions & 2 deletions ext/date/lib/parse_iso_intervals.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,10 @@ void timelib_strtointerval(const char *s, size_t len,
in.errors->error_messages = NULL;

if (len > 0) {
while (isspace(*s) && s < e) {
while (isspace((unsigned char)*s) && s < e) {
s++;
}
while (isspace(*e) && e > s) {
while (isspace((unsigned char)*e) && e > s) {
e--;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ext/date/lib/parse_iso_intervals.re
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ void timelib_strtointerval(const char *s, size_t len,
in.errors->error_messages = NULL;

if (len > 0) {
while (isspace(*s) && s < e) {
while (isspace((unsigned char)*s) && s < e) {
s++;
}
while (isspace(*e) && e > s) {
while (isspace((unsigned char)*e) && e > s) {
e--;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/date/lib/timelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void timelib_time_tz_abbr_update(timelib_time* tm, const char* tz_abbr)
TIMELIB_TIME_FREE(tm->tz_abbr);
tm->tz_abbr = timelib_strdup(tz_abbr);
for (i = 0; i < tz_abbr_len; i++) {
tm->tz_abbr[i] = toupper(tz_abbr[i]);
tm->tz_abbr[i] = toupper((unsigned char)tz_abbr[i]);
}
}

Expand Down
10 changes: 5 additions & 5 deletions ext/filter/logical_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,21 +533,21 @@ static bool php_filter_validate_domain_ex(const zend_string *domain, zend_long f
}

/* First char must be alphanumeric */
if(*s == '.' || (hostname && !isalnum((int)*(unsigned char *)s))) {
if(*s == '.' || (hostname && !isalnum((unsigned char)*s))) {
return false;
}

while (s < e) {
if (*s == '.') {
/* The first and the last character of a label must be alphanumeric */
if (*(s + 1) == '.' || (hostname && (!isalnum((int)*(unsigned char *)(s - 1)) || !isalnum((int)*(unsigned char *)(s + 1))))) {
if (*(s + 1) == '.' || (hostname && (!isalnum((unsigned char)s[-1]) || !isalnum((unsigned char)s[1])))) {
return false;
}

/* Reset label length counter */
i = 1;
} else {
if (i > 63 || (hostname && (*s != '-' || *(s + 1) == '\0') && !isalnum((int)*(unsigned char *)s))) {
if (i > 63 || (hostname && (*s != '-' || *(s + 1) == '\0') && !isalnum((unsigned char)*s))) {
return false;
}

Expand Down Expand Up @@ -575,9 +575,9 @@ static bool is_userinfo_valid(const zend_string *str)
const char *p = ZSTR_VAL(str);
while (p - ZSTR_VAL(str) < ZSTR_LEN(str)) {
static const char *valid = "-._~!$&'()*+,;=:";
if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) {
if (isalpha((unsigned char)*p) || isdigit((unsigned char)*p) || strchr(valid, *p)) {
p++;
} else if (*p == '%' && p - ZSTR_VAL(str) <= ZSTR_LEN(str) - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) {
} else if (*p == '%' && p - ZSTR_VAL(str) <= ZSTR_LEN(str) - 3 && isdigit((unsigned char)p[1]) && isxdigit((unsigned char)p[2])) {
p += 3;
} else {
return false;
Expand Down
10 changes: 5 additions & 5 deletions ext/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void ftp_raw(ftpbuf_t *ftp, const char *cmd, const size_t cmd_len, zval *return_
array_init(return_value);
while (ftp_readline(ftp)) {
add_next_index_string(return_value, ftp->inbuf);
if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
if (isdigit((unsigned char)ftp->inbuf[0]) && isdigit((unsigned char)ftp->inbuf[1]) && isdigit((unsigned char)ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
return;
}
}
Expand Down Expand Up @@ -789,7 +789,7 @@ bool ftp_pasv(ftpbuf_t *ftp, int pasv)
return false;
}
/* parse out the IP and port */
for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
for (ptr = ftp->inbuf; *ptr && !isdigit((unsigned char)*ptr); ptr++);
n = sscanf(ptr, "%lu,%lu,%lu,%lu,%lu,%lu", &b[0], &b[1], &b[2], &b[3], &b[4], &b[5]);
if (n != 6) {
return false;
Expand Down Expand Up @@ -1100,7 +1100,7 @@ time_t ftp_mdtm(ftpbuf_t *ftp, const char *path, const size_t path_len)
return -1;
}
/* parse out the timestamp */
for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
for (ptr = ftp->inbuf; *ptr && !isdigit((unsigned char)*ptr); ptr++);
n = sscanf(ptr, "%4d%2d%2d%2d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6) {
return -1;
Expand Down Expand Up @@ -1276,13 +1276,13 @@ static bool ftp_getresp(ftpbuf_t *ftp)
}

/* Break out when the end-tag is found */
if (isdigit(ftp->inbuf[0]) && isdigit(ftp->inbuf[1]) && isdigit(ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
if (isdigit((unsigned char)ftp->inbuf[0]) && isdigit((unsigned char)ftp->inbuf[1]) && isdigit((unsigned char)ftp->inbuf[2]) && ftp->inbuf[3] == ' ') {
break;
}
}

/* translate the tag */
if (!isdigit(ftp->inbuf[0]) || !isdigit(ftp->inbuf[1]) || !isdigit(ftp->inbuf[2])) {
if (!isdigit((unsigned char)ftp->inbuf[0]) || !isdigit((unsigned char)ftp->inbuf[1]) || !isdigit((unsigned char)ftp->inbuf[2])) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion ext/gd/libgd/gd_xbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out)
} else {
for (i=0; i<l; i++) {
/* only in C-locale isalnum() would work */
if (!isupper(name[i]) && !islower(name[i]) && !isdigit(name[i])) {
if (!isupper((unsigned char)name[i]) && !islower((unsigned char)name[i]) && !isdigit((unsigned char)name[i])) {
name[i] = '_';
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/gmp/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ static zend_result convert_zstr_to_gmp(mpz_t gmp_number, const zend_string *val,
bool skip_lead = false;

size_t num_len = ZSTR_LEN(val);
while (isspace(*num_str)) {
while (isspace((unsigned char)*num_str)) {
++num_str;
--num_len;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/locale/locale_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ static int strToMatch(const char* str ,char *retstr)
if( *str == '-' ){
*retstr = '_';
} else {
*retstr = tolower(*str);
*retstr = tolower((unsigned char)*str);
}
str++;
retstr++;
Expand Down
6 changes: 4 additions & 2 deletions ext/mbstring/libmbfl/mbfl/mbfl_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ const mbfl_encoding *mbfl_name2encoding_ex(const char *name, size_t name_len)
/* search MIME charset name */
for (encoding = mbfl_encoding_ptr_list; *encoding; encoding++) {
if ((*encoding)->mime_name) {
if (strncasecmp((*encoding)->mime_name, name, name_len) == 0 && (*encoding)->mime_name[name_len] == '\0') {
size_t mime_len = strlen((*encoding)->mime_name);
if (mime_len == name_len && strncasecmp((*encoding)->mime_name, name, name_len) == 0) {
return *encoding;
}
}
Expand All @@ -352,7 +353,8 @@ const mbfl_encoding *mbfl_name2encoding_ex(const char *name, size_t name_len)
for (encoding = mbfl_encoding_ptr_list; *encoding; encoding++) {
if ((*encoding)->aliases) {
for (const char **alias = (*encoding)->aliases; *alias; alias++) {
if (strncasecmp(name, *alias, name_len) == 0 && (*alias)[name_len] == '\0') {
size_t alias_len = strlen(*alias);
if (alias_len == name_len && strncasecmp(name, *alias, name_len) == 0) {
return *encoding;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ext/mbstring/mbstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,

static char *php_mb_rfc1867_getword_conf(const zend_encoding *encoding, char *str) /* {{{ */
{
while (*str && isspace(*(unsigned char *)str)) {
while (*str && isspace((unsigned char)*str)) {
++str;
}

Expand All @@ -640,7 +640,7 @@ static char *php_mb_rfc1867_getword_conf(const zend_encoding *encoding, char *st
} else {
char *strend = str;

while (*strend && !isspace(*(unsigned char *)strend)) {
while (*strend && !isspace((unsigned char)*strend)) {
++strend;
}
return php_mb_rfc1867_substring_conf(encoding, str, strend - str, 0);
Expand Down
Loading