Summary:ASTERISK-07145: Malformed callerid string causes SIP clients to silently drop packets
Reporter:Kenneth Girrard (kgirrard)Labels:
Date Opened:2006-06-11 21:57:51Date Closed:2011-06-07 14:07:54
Versions:Frequency of
Description:Parsing of callerid name and number information in callerid.c will can return data that later causes malformed SIP headers (and potentially others) by not stripping quotes out of the name if the supplied configuration is incorrectly formatted. Including code to strip both whitespace and quotes avoids this failure.


Patch to callerid.c:

<                       /* Just trim off any trailing spaces */
>                       /* Just trim off any leading spaces or quotes */
<                       while(!ast_strlen_zero(instr) && (instr[strlen(instr) - 1] < 33))
<                               instr[strlen(instr) - 1] = '\0';
<                       /* And leading spaces */
<                       *name = ast_skip_blanks(*name);
>                       while(*(*name) && ((*(*name) < 33) || (*(*name) == '\"'))) (*name)++;
>                       /* And trailing spaces or quotes */
>                       ne = *name + strlen(*name) - 1;
>                       while((ne > *name) && ((*ne < 33) || (*ne == '\"'))) { *ne = '\0'; ne--; }
Comments:By: Serge Vecher (serge-v) 2006-06-12 09:05:39

kgirrard: are you having the same problem as in http://bugs.digium.com/view.php?id=7333 ?

By: Olle Johansson (oej) 2006-06-12 09:06:35

We need a disclaimer to be able to work with your patch at all.

By: Kenneth Girrard (kgirrard) 2006-06-12 12:32:31

The code in the supplied patch is from the same function (ast_callerid_parse) in callerid.c (about 15 lines below where my change is made). If I still need to fax a disclaimer just say Yeah and I'll provide one.

The bug referenced in note 47661 is this bug. ???  I found no similar issues in existing reports, but will verify if there is another one.

This is only one approach to fixing this, by quietly correcting incorrectly formatted configuration data. The other option would be for ast_callerid_parse to fail when quotes are not properly balanced.

By: Serge Vecher (serge-v) 2006-06-19 11:54:09

kgirrard: yes, please send a disclaimer to Digium and confirm when you've done so. Also, please upload the change as a patchfile. Thanks.

By: Serge Vecher (serge-v) 2006-06-28 11:09:31

still need disclaimer and patchfile.

By: Serge Vecher (serge-v) 2006-07-12 13:34:49

suspending due to no response from kgirrard. When you have filed a disclaimer and have a patch file available, please feel free to reopen the issue with patch attached and mentioning the disclaimer status. Thank you.