summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2000-07-01 21:34:45 +0000
committerSterling Hughes <sterling@php.net>2000-07-01 21:34:45 +0000
commita43572123c7ad71b863430753e6ff5f9974b45d5 (patch)
treef50b2b034bad107b0eac8725e9a0a4111cf04497
parent2b61d55b1df84417c603c9adebb8bb5a2f6cf9cb (diff)
downloadphp-git-a43572123c7ad71b863430753e6ff5f9974b45d5.tar.gz
- strdup -> estrdup
- check whether return_value array is initialized.
-rw-r--r--ext/snmp/snmp.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 13637b9e8c..20c5542ed0 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -86,7 +86,14 @@ function_entry snmp_functions[] = {
};
zend_module_entry snmp_module_entry = {
- "snmp",snmp_functions,PHP_MINIT(snmp),NULL,NULL,NULL,PHP_MINFO(snmp),STANDARD_MODULE_PROPERTIES
+ "snmp",
+ snmp_functions,
+ PHP_MINIT(snmp),
+ NULL,
+ NULL,
+ NULL,
+ PHP_MINFO(snmp),
+ STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_SNMP
@@ -210,9 +217,9 @@ void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
* memory it did not allocate
*/
#ifdef UCD_SNMP_HACK
- session.community = (u_char *) strdup((*a2)->value.str.val);
+ session.community = (u_char *)estrdup((*a2)->value.str.val);
#else
- session.community = (u_char *) (*a2)->value.str.val;
+ session.community = (u_char *)(*a2)->value.str.val;
#endif
session.community_len = (*a2)->value.str.len;
session.retries = retries;
@@ -229,7 +236,10 @@ void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
if (st >= 2) {
memmove((char *)name, (char *)root, rootlen * sizeof(oid));
name_length = rootlen;
- array_init(return_value); /* prepare result array */
+ if (array_init(return_value) == FAILURE) {
+ php_error(E_WARNING, "Cannot prepare result array");
+ RETURN_FALSE;
+ }
}
while(keepwalking) {