Skip to content

sapi/lsapi: fix sapi_lsapi_ub_write() return value on short write - #23426

Open
lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/issue-23424-lsapi-ub-write-return
Open

sapi/lsapi: fix sapi_lsapi_ub_write() return value on short write#23426
lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/issue-23424-lsapi-ub-write-return

Conversation

@lazerg

@lazerg lazerg commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

sapi_lsapi_ub_write() returns str_length - ret when LSAPI_Write() writes fewer bytes than requested. LSAPI_Write() already returns the number of bytes it wrote (LSAPI_Write_r() in lsapilib.c returns p - pBuf, or -1 on error), the same contract every other ub_write in this codebase follows, e.g. sapi_cli_ub_write() returns ptr - str. Subtracting that count from str_length gives the wrong value. Return ret instead.

Fixes #23424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant