From: Boian Bonev Date: Thu, 8 Feb 2001 23:31:01 +0000 (+0000) Subject: fixed SIGSEGV in vpopmail_auth_user when optional arg apop is not set X-Git-Tag: php-4.0.5RC1~327 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7a148a75841de22f53ed9207795933dc6ddf0b8;p=php fixed SIGSEGV in vpopmail_auth_user when optional arg apop is not set --- diff --git a/ext/vpopmail/php_vpopmail.c b/ext/vpopmail/php_vpopmail.c index 291617126b..05000f0d7b 100644 --- a/ext/vpopmail/php_vpopmail.c +++ b/ext/vpopmail/php_vpopmail.c @@ -694,12 +694,13 @@ PHP_FUNCTION(vpopmail_auth_user) zval **password; zval **apop; struct passwd *retval; + int argc=ZEND_NUM_ARGS(); - if (ZEND_NUM_ARGS() < 3 || ZEND_NUM_ARGS() > 4 + if (argc < 3 || argc > 4 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &user, &domain, &password, &apop) == FAILURE) WRONG_PARAM_COUNT; - if (ZEND_NUM_ARGS() > 3) + if (argc > 3) convert_to_string_ex(apop); convert_to_string_ex(user); @@ -713,7 +714,7 @@ PHP_FUNCTION(vpopmail_auth_user) retval = vauth_user(Z_STRVAL_PP(user), Z_STRVAL_PP(domain), Z_STRVAL_PP(password), - Z_STRVAL_PP(apop)); + (argc>3)?Z_STRVAL_PP(apop):""); /* * we do not set vpopmail_errno here - it is considered auth_user cannot fail; insted it does not auth