diff options
author | Chuck Hagenbuch <chagenbu@php.net> | 2000-10-17 15:52:04 +0000 |
---|---|---|
committer | Chuck Hagenbuch <chagenbu@php.net> | 2000-10-17 15:52:04 +0000 |
commit | 9e693657d942eeab5f997d919676a035dd564021 (patch) | |
tree | 72609ed876bd6139c6fb62e30a293599395f078d /ext/mcal/php_mcal.c | |
parent | 0b59e4b821ece80b583f088613d8b52282e3c7a4 (diff) | |
download | php-git-9e693657d942eeab5f997d919676a035dd564021.tar.gz |
replace fixed-size buffers for username and password with dynamically
allocated strings in the MCAL extension.
Diffstat (limited to 'ext/mcal/php_mcal.c')
-rw-r--r-- | ext/mcal/php_mcal.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/mcal/php_mcal.c b/ext/mcal/php_mcal.c index d9572f0a66..1346bdb5d4 100644 --- a/ext/mcal/php_mcal.c +++ b/ext/mcal/php_mcal.c @@ -122,8 +122,8 @@ ZEND_GET_MODULE(php_mcal) thread local_ storage */ int le_mcal; -char mcal_user[80]=""; -char mcal_password[80]=""; +char *mcal_user; +char *mcal_password; CALSTREAM *cal_close_it (pils *mcal_le_struct) { @@ -223,13 +223,16 @@ void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) convert_to_string_ex(calendar); convert_to_string_ex(user); convert_to_string_ex(passwd); - strcpy(mcal_user, (*user)->value.str.val); - strcpy(mcal_password, (*passwd)->value.str.val); + mcal_user = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user)); + mcal_password = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd)); if (myargc == 4) { convert_to_long_ex(options); flags = (*options)->value.lval; } mcal_stream = cal_open(NULL, (*calendar)->value.str.val, 0); + efree(mcal_user); + efree(mcal_password); + if (!mcal_stream) { php_error(E_WARNING, "Couldn't open stream %s\n", (*calendar)->value.str.val); RETURN_FALSE; |