[php-src] Issue #23424: sapi_lsapi_ub_write does not return bytes written in lsapi mode
| From: | Sjord | Date: | Sun, 23 Aug 2026 19:37:00 +0000 |
| Subject: | [php-src] Issue #23424: sapi_lsapi_ub_write does not return bytes written in lsapi mode | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252654@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23424
Author: Sjord
### Description
sapi/litespeed/lsapi_main.c:
```
static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
{
int ret;
int remain;
if ( lsapi_mode ) {
ret = LSAPI_Write( str, str_length );
if ( ret < str_length ) {
php_handle_aborted_connection();
return str_length - ret;
}
} else {
remain = str_length;
while( remain > 0 ) {
ret = write( 1, str, remain );
if ( ret <= 0 ) {
php_handle_aborted_connection();
return str_length - remain;
}
str += ret;
remain -= ret;
}
}
return str_length;
}
```
It seems to me that
LSAPI_Write returns the number of bytes written. If this is less
than the length of the string, something went wrong. But it then returns str_length -
ret, where it should return ret.
### PHP Version
```plain
master
```
### Operating System
_No response_