mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
Fixed off-by-one buffer issue in uv_exepath()
This commit is contained in:
parent
91ee8f491a
commit
39a7fe3c7e
14
php_uv.c
14
php_uv.c
@ -4951,13 +4951,13 @@ PHP_FUNCTION(uv_hrtime)
|
||||
*/
|
||||
PHP_FUNCTION(uv_exepath)
|
||||
{
|
||||
char buffer[1024] = {0};
|
||||
size_t buffer_sz;
|
||||
|
||||
buffer_sz = sizeof(buffer);
|
||||
uv_exepath(buffer, &buffer_sz);
|
||||
buffer[buffer_sz] = '\0';
|
||||
|
||||
char buffer[MAXPATHLEN];
|
||||
size_t buffer_sz = sizeof(buffer) / sizeof(buffer[0]);
|
||||
|
||||
if (uv_exepath(buffer, &buffer_sz) == UV_EINVAL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_STRINGL(buffer, buffer_sz, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
Loading…
Reference in New Issue
Block a user