From: Derick Rethans Date: Wed, 2 Nov 2005 15:53:49 +0000 (+0000) Subject: - MFH: Fixed initializing and argument checking for posix_mknod(). X-Git-Tag: php-5.1.0RC5~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=703fc059bf49c0183c3c4a5bc6ab31c9e4f8a93e;p=php - MFH: Fixed initializing and argument checking for posix_mknod(). --- diff --git a/NEWS b/NEWS index 6d542bf187..8b31b01e1d 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Nov 2005, PHP 5.1 +- Fixed initializing and argument checking for posix_mknod(). (Derick) - Fixed bugs #35022, #35019 (Regression in the behavior of key() and current() functions). (Ilia) - Fixed bug #35017 (Exception thrown in error handler may cause unexpected diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 26b76cc4bf..890609e565 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -676,7 +676,7 @@ PHP_FUNCTION(posix_mknod) char *path; int path_len; long mode; - long major, minor = 0; + long major = 0, minor = 0; int result; dev_t php_dev; @@ -693,9 +693,13 @@ PHP_FUNCTION(posix_mknod) } if ((mode & S_IFCHR) || (mode & S_IFBLK)) { + if (ZEND_NUM_ARGS() == 2) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "For S_IFCHR and S_IFBLK you need to pass a major device kernel identifier"); + RETURN_FALSE; + } if (major == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, - "expects argument 4 to be non-zero for POSIX_S_IFCHR and POSIX_S_IFBLK"); + "Expects argument 3 to be non-zero for POSIX_S_IFCHR and POSIX_S_IFBLK"); RETURN_FALSE; } else { #if defined(HAVE_MAKEDEV) || defined(makedev)