Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ed8b111

Browse files
committed
Fix potential OOB when checking for trailing spaces
If `path_len` is zero, we must not access `path`, let alone try to subtract `-1` from it. Since `path` and `path_len` are supposed to come from a `zend_string`, this is not a security issue. Closes GH-17471.
1 parent 022a5fc commit ed8b111

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

‎NEWS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PHP NEWS
1111
inherited final). (ilutov)
1212
. Fixed NULL arithmetic during system program execution on Windows. (cmb,
1313
nielsdos)
14+
. Fixed potential OOB when checking for trailing spaces on Windows. (cmb)
1415

1516
- Enchant:
1617
. Fix crashes in enchant when passing null bytes. (nielsdos)

‎win32/winutil.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ PHP_WINUTIL_API void php_win32_error_msg_free(char *msg)
5656

5757
int php_win32_check_trailing_space(const char * path, const size_t path_len)
5858
{/*{{{*/
59-
if (path_len > MAXPATHLEN - 1) {
59+
if (path_len ==0||path_len> MAXPATHLEN - 1) {
6060
return 1;
6161
}
6262
if (path) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /