[Home]

Summary:ASTERISK-15277: [patch] Segfault in res_config_ldap
Reporter:Ben Klang (bklang)Labels:
Date Opened:2009-12-04 17:59:20.000-0600Date Closed:2010-01-12 11:14:48.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Resources/res_config_ldap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) gdb.txt
( 1) gdb2.txt
( 2) res_config_ldap.patch
Description:My system has been crashing intermittently today since I enabled res_config_ldap.  At the moment I don't have many clues because it happens when I am not watching the console.  However it appears to be related to an attempt to update LDAP for a RealTime SIP peer, though at the time of the crash no actual RealTime SIP peers were active.  Non-RealTime SIP peers were active (configured in sip.conf).

Attached is the output from gdb (bt; bt full; thread apply all bt).
Please let me know if I can provide any additional information.
Comments:By: Ben Klang (bklang) 2009-12-04 18:00:58.000-0600

Whoops, I attached the wrong gdb.txt.  Please disregard it!

Please see gdb2.txt for the correct crash information.

By: Gavin Henry (suretec) 2009-12-08 09:42:59.000-0600

Thanks. Will try to get to this soon.

By: Tim Stewart (applsplatz) 2009-12-15 16:32:58.000-0600

I believe I have fixed this issue.

update_ldap() initially allocates memory for ldap_mods[0]->mod_values, which becomes an array of two addresses, the first to a char * and the second as NULL.  ldap_mods[0]->mod_values was only allocated two bytes rather than the 8 bytes needed for two memory addresses.  Changing the line to "sizeof(char *)" fixes this issue on my system.

I'm attaching a patch called res_config_ldap.patch.  Enjoy.

By: Gavin Henry (suretec) 2009-12-15 16:35:23.000-0600

Thanks!

By: Tim Stewart (applsplatz) 2009-12-15 16:49:10.000-0600

I have uploaded the patch.  It should appear once my license acceptance has been approved.

By: Digium Subversion (svnbot) 2010-01-12 11:09:13.000-0600

Repository: asterisk
Revision: 239473

U   trunk/res/res_config_ldap.c

------------------------------------------------------------------------
r239473 | seanbright | 2010-01-12 11:09:12 -0600 (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 ASTERISK-15277)
Reported by: bklang
Patches:
     res_config_ldap.patch uploaded by applsplatz (license 949)
Tested by: applsplatz

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=239473

By: Digium Subversion (svnbot) 2010-01-12 11:14:40.000-0600

Repository: asterisk
Revision: 239475

_U  branches/1.6.0/
U   branches/1.6.0/res/res_config_ldap.c

------------------------------------------------------------------------
r239475 | seanbright | 2010-01-12 11:14:39 -0600 (Tue, 12 Jan 2010) | 17 lines

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 ASTERISK-15277)
 Reported by: bklang
 Patches:
       res_config_ldap.patch uploaded by applsplatz (license 949)
 Tested by: applsplatz
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=239475

By: Digium Subversion (svnbot) 2010-01-12 11:14:44.000-0600

Repository: asterisk
Revision: 239476

_U  branches/1.6.1/
U   branches/1.6.1/res/res_config_ldap.c

------------------------------------------------------------------------
r239476 | seanbright | 2010-01-12 11:14:44 -0600 (Tue, 12 Jan 2010) | 17 lines

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 ASTERISK-15277)
 Reported by: bklang
 Patches:
       res_config_ldap.patch uploaded by applsplatz (license 949)
 Tested by: applsplatz
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=239476

By: Digium Subversion (svnbot) 2010-01-12 11:14:47.000-0600

Repository: asterisk
Revision: 239477

_U  branches/1.6.2/
U   branches/1.6.2/res/res_config_ldap.c

------------------------------------------------------------------------
r239477 | seanbright | 2010-01-12 11:14:47 -0600 (Tue, 12 Jan 2010) | 17 lines

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 ASTERISK-15277)
 Reported by: bklang
 Patches:
       res_config_ldap.patch uploaded by applsplatz (license 949)
 Tested by: applsplatz
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=239477