[Home]

Summary:ASTERISK-01078: [patch] app_cut corruption
Reporter:ktsaou (ktsaou)Labels:
Date Opened:2004-02-23 05:18:57.000-0600Date Closed:2008-01-15 14:44:23.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20040223__cut_fix.diff.txt
Description:This context:

[dial-sip]
exten => _SIP:.,1,Cut(address=EXTEN|:|2)
exten => _SIP:.,2,Cut(domain=address|@|2)
exten => _SIP:.,3,Cut(user=address|@|1)
exten => _SIP:.,4,SetCDRUserField(${CALLERIDNUM} => sip:${user}@${domain})
exten => _SIP:.,5,Dial(SIP/${domain}/${user},60,Tr)
exten => _SIP:.,6,Congestion
exten => _SIP:.,7,Hangup
exten => _SIP:.,106,Busy
exten => _SIP:.,107,Hangup

Appears to corrupt the values cut.
(local-hol.net includes dial-sip):

   -- Goto (local-hol.net,SIP:costa@tsaousis.gr,1)
   -- Executing Cut("SIP/ktsaou-hol.net-5e21", "address=EXTEN|:|2") in new stack
   -- Executing Cut("SIP/ktsaou-hol.net-5e21", "domain=address|@|2") in new stack
   -- Executing Cut("SIP/ktsaou-hol.net-5e21", "user=address|@|1") in new stack
   -- Executing SetCDRUserField("SIP/ktsaou-hol.net-5e21", "ktsaou@hol.net => sip:costa@tsaousis.g&ASTERISK-928;˜=˜=") in new stack
   -- Executing Dial("SIP/ktsaou-hol.net-5e21", "SIP/tsaousis.g&ASTERISK-928;˜=˜=/costa|60|Tr") in new stack

If I call it with:

- "SIP:costa@tsaousis.gr:" = same results
- "SIP:costa@tsaousis.gr@:" = works fine then
Comments:By: ktsaou (ktsaou) 2004-02-23 05:26:36.000-0600

Sorry for marking this with severity=feature. It is not a feature of course...

By: ktsaou (ktsaou) 2004-02-23 05:58:36.000-0600

Also, I have included ${address} in SetCDRUserField to diagnose which Cut corrupts the value, and it appears that the 1st one is the problem.

Then I changed the first Cut to:

exten => _SIP:.,1,SetVar(address=${EXTEN:4})

and the corruption "moved" to the second Cut (domain).

By: Tilghman Lesher (tilghman) 2004-02-23 16:09:44.000-0600

I've tracked it down to somewhere in the core routine pbx_substitute_variables_helper().  It appears that this routine does not null-terminate its results.

Workaround attached.  Please apply, recompile, and restart.

edited on: 02-23-04 15:01

By: ktsaou (ktsaou) 2004-02-23 17:15:36.000-0600

Yeap. This seems to fix the problem.
Thanx.

By: Mark Spencer (markster) 2004-02-24 14:09:35.000-0600

Fixed in CVS

By: Digium Subversion (svnbot) 2008-01-15 14:44:22.000-0600

Repository: asterisk
Revision: 2229

U   trunk/apps/app_cut.c

------------------------------------------------------------------------
r2229 | markster | 2008-01-15 14:44:22 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix corruptin in app_cut (bug ASTERISK-1078)

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

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

By: Digium Subversion (svnbot) 2008-01-15 14:44:23.000-0600

Repository: asterisk
Revision: 2230

U   branches/v1-0_stable/apps/app_cut.c

------------------------------------------------------------------------
r2230 | markster | 2008-01-15 14:44:23 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix corruptin in app_cut (bug ASTERISK-1078)

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

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