[asterisk-bugs] [Asterisk 0016291]: app_voicemail.c strip_control() strips more than just control chars

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Dec 4 11:47:17 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16291 
====================================================================== 
Reported By:                wdoekes
Assigned To:                dvossel
====================================================================== 
Project:                    Asterisk
Issue ID:                   16291
Category:                   Applications/app_voicemail
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     closed
Target Version:             1.4.29
Asterisk Version:           SVN 
JIRA:                       SWP-441 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-11-20 05:25 CST
Last Modified:              2009-12-04 11:47 CST
====================================================================== 
Summary:                    app_voicemail.c strip_control() strips more than
just control chars
Description: 
In app_voicemail.c in the function strip_control, the following check is
done:

static char *strip_control(const char *input, char *buf, size_t buflen)
{
        char *bufptr = buf;
        for (; *input; input++) {
                if (*input < 32) {
                        continue;

On many platforms, char is signed by default.
This way not only control characters, but also all characters above 127
are filtered as well.

This could be considered intended behaviour to make sure the Subject and
X-headers get 7-bit clean data, but as there also is a ast_str_encode_mime
to encode >127 chars according to a selected character set, it looks more
like a bug.

Suggested fix:
- Either rename strip_control to strip_control_and_high,
- Or cast (*input) to (unsigned char) in the comparison and add
ast_str_encode_mime calls to the X-headers where enc_cidnum and enc_cidname
are used.


Regards,
Walter Doekes
OSSO B.V.
====================================================================== 

---------------------------------------------------------------------- 
 (0114774) svnbot (reporter) - 2009-12-04 11:47
 https://issues.asterisk.org/view.php?id=16291#c114774 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 233167

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_voicemail.c

------------------------------------------------------------------------
r233167 | dvossel | 2009-12-04 11:47:16 -0600 (Fri, 04 Dec 2009) | 19
lines

Merged revisions 233121 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r233121 | dvossel | 2009-12-04 11:22:31 -0600 (Fri, 04 Dec 2009) | 12
lines
  
  Merged revisions 233116 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r233116 | dvossel | 2009-12-04 11:21:34 -0600 (Fri, 04 Dec 2009) | 6
lines
    
    document and rename strip_control() in app_voicemail
    
    (closes issue https://issues.asterisk.org/view.php?id=16291)
    Reported by: wdoekes
  ........
................

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-12-04 11:47 svnbot         Checkin                                      
2009-12-04 11:47 svnbot         Note Added: 0114774                          
======================================================================




More information about the asterisk-bugs mailing list