diff options
author | Matthew Jordan <mjordan@digium.com> | 2015-03-14 01:22:01 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2015-03-14 01:22:01 +0000 |
commit | b4cc056067b7576dd5843045c89443b58828082b (patch) | |
tree | 8d7d530adc9b2eb91191006c9266949bb60f1d78 /funcs/func_env.c | |
parent | dc752f515be0e3eed80a4043ae9383dbfbd22bc4 (diff) |
FILE: fix retrieval of file contents when offset is specified
The loop that reads in a file was not correctly using the offset when
determining what bytes to append to the output. This patch corrects
the logic such that the correct portion of the file is extracted when an
offset is specified.
ASTERISK-21765
Reported by: John Zhong
Tested by: Matt Jordan, Di-Shi Sun
patches:
file_read_390821.patch uploaded by Di-Shi Sun (License 5076)
........
Merged revisions 432935 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432938 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_env.c')
-rw-r--r-- | funcs/func_env.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/funcs/func_env.c b/funcs/func_env.c index 1d3e95c0e..0daa7f48d 100644 --- a/funcs/func_env.c +++ b/funcs/func_env.c @@ -561,7 +561,7 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, stru /* Don't go past the length requested */ if (off_i + toappend > offset + length) { - toappend = length - off_i; + toappend = offset + length - off_i; } ast_str_append_substr(buf, len, fbuf, toappend); |