[asterisk-bugs] [Asterisk 0014670]: FILE function reads 1 character less than specified in length

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Mar 16 12:38:52 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14670 
====================================================================== 
Reported By:                BMC
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   14670
Category:                   Functions/func_env
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Asterisk Version:           1.6.0.6 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!):  
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-03-15 13:46 CDT
Last Modified:              2009-03-16 12:38 CDT
====================================================================== 
Summary:                    FILE function reads 1 character less than specified
in length
Description: 
The replacement of ReadFile does not work as specified:

cat /tmp/test.txt
123456789

exten => s,n,ReadFile(VAR1=/tmp/test.txt,2);
exten => s,n,NoOp(VAR1=${VAR1});
exten => s,n,Set(VAR2=${FILE(/tmp/test.txt,0,2)});
exten => s,n,NoOp(VAR2=${VAR2});

    -- Executing [s at test:2] ReadFile("mISDN/3-u46",
"VAR1=/tmp/test.txt,2") in new stack
    -- Executing [s at test:3] NoOp("mISDN/3-u46", "VAR1=12") in new stack
    -- Executing [s at test:4] Set("mISDN/3-u46", "VAR2=1") in new stack
    -- Executing [s at test:5] NoOp("mISDN/3-u46", "VAR2=1") in new stack


====================================================================== 

---------------------------------------------------------------------- 
 (0101810) svnbot (reporter) - 2009-03-16 12:38
 http://bugs.digium.com/view.php?id=14670#c101810 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 182280

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_local.c
U   branches/1.6.1/funcs/func_env.c

------------------------------------------------------------------------
r182280 | tilghman | 2009-03-16 12:38:51 -0500 (Mon, 16 Mar 2009) | 30
lines

Merged revisions 182211,182278 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r182211 | tilghman | 2009-03-16 10:50:55 -0500 (Mon, 16 Mar 2009) | 14
lines
  
  Merged revisions 182208 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r182208 | tilghman | 2009-03-16 10:39:15 -0500 (Mon, 16 Mar 2009) | 7
lines
    
    Fixup glare detection, to fix a memory leak of a local pvt structure.
    (closes issue http://bugs.digium.com/view.php?id=14656)
     Reported by: caspy
     Patches: 
           20090313__bug14656__2.diff.txt uploaded by tilghman (license
14)
     Tested by: caspy
  ........
................
  r182278 | tilghman | 2009-03-16 12:33:38 -0500 (Mon, 16 Mar 2009) | 7
lines
  
  Fix an off-by-one error in the FILE() function, and extend FILE()'s
length parameter to work like variable substitution.
  Previously, FILE() returned one less character than specified, due to
the
  terminating NULL.  Both the offset and length parameters now behave
  identically to the way variable substitution offsets and lengths also
work.
  (closes issue http://bugs.digium.com/view.php?id=14670)
   Reported by: BMC
................

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-03-16 12:38 svnbot         Checkin                                      
2009-03-16 12:38 svnbot         Note Added: 0101810                          
======================================================================




More information about the asterisk-bugs mailing list