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

Fix buffer access of a referenced string #436

Open
stephaneDunand opened this issue Feb 20, 2020 · 0 comments
Open

Fix buffer access of a referenced string #436

stephaneDunand opened this issue Feb 20, 2020 · 0 comments

Comments

@stephaneDunand
Copy link

stephaneDunand commented Feb 20, 2020

Hello,
I have identified an error with referenced string in the following two methods. Here is the correction I propose (in zend/value.cpp) :
char *Value::buffer() const
{
// must be a string
if (!isString()) return nullptr;

zend_string* zs = zval_get_string(_val);
char* raw = ZSTR_VAL(zs);
zend_string_release(zs);
return raw;

}
const char *Value::rawValue() const
{
// must be a string
if (!isString()) return nullptr;

zend_string* zs = zval_get_string(_val);
char* raw = ZSTR_VAL(zs);
zend_string_release(zs);
return (const char*)raw;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant