summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2010-01-12 17:09:12 +0000
committerSean Bright <sean@malleable.com>2010-01-12 17:09:12 +0000
commita5688e483bc7fbd5c4ee1ef4ef3b3470fba6e9e9 (patch)
tree4d8e7ff42cd3fa4e4e35a98e79a359fc1b9fdc7b /res
parentfa0ef8031dab6a50134e14c80ab4cf69ed11fa45 (diff)
Fix crash in res_config_ldap.
We need to allocate enough room for 2 pointers, not 2 characters. (closes issue #16397) Reported by: bklang Patches: res_config_ldap.patch uploaded by applsplatz (license 949) Tested by: applsplatz git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@239473 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_config_ldap.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 0438f3109..3e0b8e106 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1214,12 +1214,10 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
ldap_mods[0] = ast_calloc(1, sizeof(LDAPMod));
ldap_mods[0]->mod_op = LDAP_MOD_REPLACE;
- ldap_mods[0]->mod_type = ast_calloc(sizeof(char), strlen(newparam) + 1);
- strcpy(ldap_mods[0]->mod_type, newparam);
+ ldap_mods[0]->mod_type = ast_strdup(newparam);
- ldap_mods[0]->mod_values = ast_calloc(sizeof(char), 2);
- ldap_mods[0]->mod_values[0] = ast_calloc(sizeof(char), strlen(newval) + 1);
- strcpy(ldap_mods[0]->mod_values[0], newval);
+ ldap_mods[0]->mod_values = ast_calloc(sizeof(char *), 2);
+ ldap_mods[0]->mod_values[0] = ast_strdup(newval);
while ((newparam = va_arg(ap, const char *))) {
newparam = convert_attribute_name_to_ldap(table_config, newparam);