You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7774891
Browse filesBrowse the repository at this point in the historyBrowse files
Fix out-of-bounds reads parsing ftp:// wrapper server replies
The ftp:// wrapper parses replies in a 512-byte buffer at fixed offsets
and sizes that are not tied to the line actually received:
- get_ftp_result() returns the code of the last line read when the
stream ends, even if it is not a complete "ddd " status line, while
the callers parse the reply text from tmp_line + 4.
- php_fopen_do_pasv() copies a fixed ip_size bytes from the dotted
address inside the buffer, reading past its end when the address is
near the end of the line, and silently truncating an over-long one.
- The MDTM parsing in php_stream_ftp_url_stat() skips non-digits past
the terminating NUL, and its bound check allows sscanf() to start one
past the end of the buffer.
Only return a code from get_ftp_result() for a complete status line,
copy exactly the parsed address and reject one that does not fit, and
stop the MDTM scan at the end of the line.
ClosesGH-24340.
0 commit comments