[asterisk-bugs] [Asterisk 0015271]: [patch] BASE64_DECODE() adds garbage end end of decoded string

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Nov 6 14:42:47 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15271 
====================================================================== 
Reported By:                chappell
Assigned To:                mnicholson
====================================================================== 
Project:                    Asterisk
Issue ID:                   15271
Category:                   Functions/func_base64
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           1.4.24 
JIRA:                       SWP-265 
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-06-04 10:16 CDT
Last Modified:              2009-11-06 14:42 CST
====================================================================== 
Summary:                    [patch] BASE64_DECODE() adds garbage end end of
decoded string
Description: 
This problem has two causes:

1) BASE64_DECODE() fails to null terminate its return value. This becomes
evident if first a long string is decoded and then a short one.  The short
one will have have the last part of the long string appended to it.

2) What is more, ast_base64decode() does not recognize the equals signs
which pad the end of a string the length of which is not a multiple of
three bytes. Rather than stopping, it decodes the padding as data,
producing bogus output.  
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0011018 patch for 10979 breaks IAX RSA auth
related to          0010979 [path] main/util.c missed *dst='\0'; in...
====================================================================== 

---------------------------------------------------------------------- 
 (0113341) svnbot (reporter) - 2009-11-06 14:42
 https://issues.asterisk.org/view.php?id=15271#c113341 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 228650

_U  branches/1.6.1/
U   branches/1.6.1/funcs/func_base64.c
U   branches/1.6.1/main/utils.c

------------------------------------------------------------------------
r228650 | mnicholson | 2009-11-06 14:42:45 -0600 (Fri, 06 Nov 2009) | 22
lines

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

................
  r228620 | mnicholson | 2009-11-06 13:47:11 -0600 (Fri, 06 Nov 2009) | 15
lines
  
  Merged revisions 228378 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r228378 | mnicholson | 2009-11-06 10:26:59 -0600 (Fri, 06 Nov 2009) |
8 lines
    
    Properly handle '=' while decoding base64 messages and null terminate
strings returned from BASE64_DECODE.
    
    (closes issue https://issues.asterisk.org/view.php?id=15271)
    Reported by: chappell
    Patches:
          base64_fix.patch uploaded by chappell (license 8)
    Tested by: kobaz
  ........
................

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-11-06 14:42 svnbot         Note Added: 0113341                          
======================================================================




More information about the asterisk-bugs mailing list