Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sapi/cgi: fix buffer limit on windows. #14022

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions main/fastcgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,9 @@ static inline ssize_t safe_read(fcgi_request *req, const void *buf, size_t count
tmp = count - n;

if (!req->tcp) {
unsigned int in_len = tmp > UINT_MAX ? UINT_MAX : (unsigned int)tmp;
unsigned int in_len = tmp > INT_MAX ? INT_MAX : (unsigned int)tmp;

ret = read(req->fd, ((char*)buf)+n, in_len);
ret = _read(req->fd, ((char*)buf)+n, in_len);
} else {
int in_len = tmp > INT_MAX ? INT_MAX : (int)tmp;

Expand Down
4 changes: 2 additions & 2 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes)
while (read_bytes < count_bytes) {
#ifdef PHP_WIN32
size_t diff = count_bytes - read_bytes;
unsigned int to_read = (diff > UINT_MAX) ? UINT_MAX : (unsigned int)diff;
unsigned int to_read = (diff > INT_MAX) ? INT_MAX : (unsigned int)diff;

tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, to_read);
tmp_read_bytes = _read(STDIN_FILENO, buffer + read_bytes, to_read);
#else
tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
#endif
Expand Down
Loading