Skip to content

GH-10141: Fix typo #11624

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *

ZEND_API ZEND_COLD ZEND_NORETURN void zend_strerror_noreturn(int type, int errn, const char *message)
{
#ifdef HAVE_STR_ERROR_R
#ifdef HAVE_STRERROR_R
char buf[1024];
strerror_r(errn, buf, sizeof(buf));
Copy link
Member

@jmikola jmikola Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dstogov: I don't think this resolves the issue I mentioned in 067df26#commitcomment-121630134. The constant typo being fixed here was a separate issue that I overlooked entirely (great catch by @petk).

The GNU version of strerror_r(3) may return a pointer to an immutable string instead of storing the result in the buf parameter. The XSI version always sets buf and returns an integer to indicate success/error.

Again, I don't think this would result in a build error. The zend_error_noreturn() line below would just end up printing message and errn with nothing between since buf would remain empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since buf would remain empty

Correction: buf would be uninitialized. I was incorrectly thinking of of static/global vars when I wrote that, which are zero-allocated.

#else
Expand Down