aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-12 17:14:39 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-12 17:14:39 +0000
commitf31db372f68101bf887ab4bfbe0a39f825422943 (patch)
treeb4ee3f5d1793e892c5add8c72aaf1bb3001bd416 /res
parent88cb61ec9a5e58c46b277fc67ca9665521079995 (diff)
Merged revisions 239473 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r239473 | seanbright | 2010-01-12 12:09:12 -0500 (Tue, 12 Jan 2010) | 10 lines 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: http://svn.digium.com/svn/asterisk/branches/1.6.0@239475 f38db490-d61c-443f-a65b-d21fe96a405b
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 0a3475871..91f526e56 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1196,12 +1196,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);