mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
Fixed off-by-one overflow, updated test case
This commit is contained in:
parent
b035466c66
commit
91ee8f491a
14
php_uv.c
14
php_uv.c
@ -4966,12 +4966,14 @@ PHP_FUNCTION(uv_exepath)
|
||||
*/
|
||||
PHP_FUNCTION(uv_cwd)
|
||||
{
|
||||
char buffer[1024] = {0};
|
||||
size_t buffer_sz = sizeof(buffer);
|
||||
|
||||
uv_cwd(buffer, buffer_sz);
|
||||
buffer[buffer_sz] = '\0';
|
||||
|
||||
char buffer[MAXPATHLEN];
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
uv_cwd(buffer, MAXPATHLEN);
|
||||
|
||||
RETURN_STRING(buffer, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -2,7 +2,7 @@
|
||||
Check for uv_chdir
|
||||
--FILE--
|
||||
<?php
|
||||
@uv_chdir(); // don't SEGV
|
||||
uv_chdir(); // don't SEGV
|
||||
|
||||
uv_chdir(dirname(__FILE__));
|
||||
if (uv_cwd() == dirname(__FILE__)) {
|
||||
@ -11,5 +11,7 @@ if (uv_cwd() == dirname(__FILE__)) {
|
||||
echo "FAILED: expected " . dirname(__FILE__) . ", but " . uv_cwd();
|
||||
}
|
||||
|
||||
--EXPECT--
|
||||
OK
|
||||
--EXPECTF--
|
||||
|
||||
Warning: uv_chdir() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
OK
|
||||
|
Loading…
Reference in New Issue
Block a user