Summary:ASTERISK-15496: [patch] res_phoneprov.so causes Asterisk to crash on ${MAC}-phone.cfg file
Reporter:Leif Madsen (lmadsen)Labels:
Date Opened:2010-01-22 18:26:09.000-0600Date Closed:2010-01-24 15:50:31.000-0600
Versions:Frequency of
Environment:Attachments:( 0) issue16680_20100122.patch
( 1) phoneprov-backtrace.txt
Description:When accessing http://192.168.x.x/phoneprov/0004f2040001-phone.cfg file (for example) Asterisk trunk will crash. I've provided the backtrace along with some notes that seanbright had me run on the backtrace via IRC.

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

Setup phoneprov then hit the http://192.168.x.x/phoneprov/0004f2040001-phone.cfg file.
Comments:By: Leif Madsen (lmadsen) 2010-01-22 18:26:25.000-0600

(gdb) f 3
#3  0x00007ffb1b186bfd in phoneprov_callback (ser=0x12f69a8, urih=0x7ffb1b38c5a0, uri=0x7ffb06c92e7f "0004f2118a0e-phone.cfg",
   method=AST_HTTP_GET, get_vars=0x0, headers=0x12ca850) at res_phoneprov.c:517
517 ast_str_set(&http_header, 0, "Content-type: %s\r\n",
(gdb) p route->file
$1 = (struct phoneprov_file *) 0x1322640

By: Leif Madsen (lmadsen) 2010-01-22 18:28:04.000-0600

(gdb) p route->file->mime_type
$2 = (const ast_string_field) 0x132269a "text/xml"

By: Leif Madsen (lmadsen) 2010-01-23 10:32:57.000-0600

Patch resolves this issue. Once it got working I have another issue, but I'm filing that as a separate bug. I haven't had a chance to try other versions of Asterisk yet to determine if this is a bug outside of trunk.

By: Digium Subversion (svnbot) 2010-01-24 15:50:30.000-0600

Repository: asterisk
Revision: 242607

U   trunk/res/res_phoneprov.c

r242607 | seanbright | 2010-01-24 15:49:17 -0600 (Sun, 24 Jan 2010) | 8 lines

Instead of crashing, allocate our header ast_str before we try to use it.

(closes issue ASTERISK-15496)
Reported by: lmadsen
     issue16680_20100122.patch uploaded by seanbright (license 71)
Tested by: lmadsen