[Home]

Summary:ASTERISK-06604: ReadFile causes Asterisk to crash when non-existing file is provided
Reporter:Ramon Peek-Fares (ramonpeek)Labels:
Date Opened:2006-03-23 12:04:23.000-0600Date Closed:2008-01-15 17:52:14.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Applications/app_readfile
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_readfile.c.diff
( 1) app_readfile.c.patch
( 2) app_readfile2.c.diff
Description:If you ask ReadFile to read a file that does not exists Asterisk crashes.
The CLI shows:

-- Executing ReadFile("SIP/537-5da0", "FOOVAR=/etc/asterisk/temp/foo.txt|1") in new stack
Mar 23 18:54:24 WARNING[21957]: app.c:1494 ast_read_textfile: Error can't stat /etc/asterisk/temp/foo.txt
pbx*CLI>
Disconnected from Asterisk server


****** STEPS TO REPRODUCE ******

Add to dialplan:

exten => 100,1,ReadFile(FOOVAR=/etc/asterisk/temp/foo.txt,1)

Then dial 100, and make sure that /etc/asterisk/temp/foo.txt does not exist.
That's all

****** ADDITIONAL INFORMATION ******

I do not have a SVN release of Asterisk running because our firewall does not allow SVN downloads. Because this error can be reproduced so easily I do not think you would need me to test this against ;)
Comments:By: Ian Kinner (ian_k) 2006-03-23 13:16:12.000-0600

app_readfile.c.patch fixes the problem. readfile_exec wasn't checking the return from ast_read_textfile.

By: Ramon Peek-Fares (ramonpeek) 2006-03-23 13:28:49.000-0600

Patch solved the problem!

Thanks! :)

By: Andrey S Pankov (casper) 2006-03-23 13:42:20.000-0600

What about LOCAL_USER_REMOVE(u); before return?

Please use app_readfile2.c.diff patch instead. Disclaimer is on file.



By: Ramon Peek-Fares (ramonpeek) 2006-03-23 13:55:11.000-0600

In new patch the next priority is also executed,
whilst previous patch just hungup.

I like the new patch better (And it also works..)

Thanks again!

By: Ramon Peek-Fares (ramonpeek) 2006-03-23 13:56:35.000-0600

Whoa, what's this!
I add a note and BANG there is another patch!!..
Oh heaven, if only MS would be this fast :))))

By: Ramon Peek-Fares (ramonpeek) 2006-03-23 13:59:19.000-0600

Oh I see... Forgot a ")"

By: Russell Bryant (russell) 2006-03-23 14:16:25.000-0600

fixed in 1.2 and the trunk in revisions 14462 and 14463, thanks!

By: Digium Subversion (svnbot) 2008-01-15 17:51:27.000-0600

Repository: asterisk
Revision: 14462

U   branches/1.2/apps/app_readfile.c

------------------------------------------------------------------------
r14462 | russell | 2008-01-15 17:51:26 -0600 (Tue, 15 Jan 2008) | 2 lines

don't crash when asked to read from a file that doesn't exist (issue ASTERISK-6604)

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

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

By: Digium Subversion (svnbot) 2008-01-15 17:51:27.000-0600

Repository: asterisk
Revision: 14463

_U  trunk/
U   trunk/apps/app_readfile.c

------------------------------------------------------------------------
r14463 | russell | 2008-01-15 17:51:27 -0600 (Tue, 15 Jan 2008) | 10 lines

Merged revisions 14462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r14462 | russell | 2006-03-23 15:13:48 -0500 (Thu, 23 Mar 2006) | 2 lines

don't crash when asked to read from a file that doesn't exist (issue ASTERISK-6604)

........

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

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

By: Digium Subversion (svnbot) 2008-01-15 17:52:14.000-0600

Repository: asterisk
Revision: 14517

_U  team/bweschke/gain_functions/
U   team/bweschke/gain_functions/apps/app_meetme.c
U   team/bweschke/gain_functions/apps/app_readfile.c
U   team/bweschke/gain_functions/pbx.c
U   team/bweschke/gain_functions/utils.c

------------------------------------------------------------------------
r14517 | bweschke | 2008-01-15 17:52:13 -0600 (Tue, 15 Jan 2008) | 42 lines

Merged revisions 14463,14470,14479,14508 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r14463 | russell | 2006-03-23 14:15:01 -0600 (Thu, 23 Mar 2006) | 10 lines

Merged revisions 14462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r14462 | russell | 2006-03-23 15:13:48 -0500 (Thu, 23 Mar 2006) | 2 lines

don't crash when asked to read from a file that doesn't exist (issue ASTERISK-6604)

........

................
r14470 | bweschke | 2006-03-23 14:48:08 -0600 (Thu, 23 Mar 2006) | 11 lines

Merged revisions 14467 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r14467 | bweschke | 2006-03-23 14:43:05 -0600 (Thu, 23 Mar 2006) | 3 lines

Bug ASTERISK-5732 - fix a possible race state in app_meetme when a channel has gone away and we are reading continuously for more frames. (mneuhauser)


........

................
r14479 | kpfleming | 2006-03-23 15:01:19 -0600 (Thu, 23 Mar 2006) | 2 lines

don't wrap this in ifdef... using va_start is safe on all platforms :-)

................
r14508 | kpfleming | 2006-03-23 15:06:26 -0600 (Thu, 23 Mar 2006) | 2 lines

correct typo

................

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

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