[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:29:21 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:                     acknowledged
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:              
====================================================================== 
Date Submitted:             2009-11-20 05:25 CST
Last Modified:              2009-12-04 11:29 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.
====================================================================== 

---------------------------------------------------------------------- 
 (0114767) svnbot (reporter) - 2009-12-04 11:29
 https://issues.asterisk.org/view.php?id=16291#c114767 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 233116

U   branches/1.4/apps/app_voicemail.c

------------------------------------------------------------------------
r233116 | dvossel | 2009-12-04 11:29:21 -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=233116 

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




More information about the asterisk-bugs mailing list