]> git.ipfire.org Git - thirdparty/asterisk.git/commit
funcs/func_env: Fix regression caused in FILE read operation
authorMatthew Jordan <mjordan@digium.com>
Thu, 19 Mar 2015 19:19:32 +0000 (19:19 +0000)
committerMatthew Jordan <mjordan@digium.com>
Thu, 19 Mar 2015 19:19:32 +0000 (19:19 +0000)
commit1e130f92975b2b815143000fa2fc2afe09ace394
tree2068810af86e7ed5f93d358a0a56dcd235e13e0e
parent485e0538eb4a94307698f36d1554930083fbe7c8
funcs/func_env: Fix regression caused in FILE read operation

When r432935 was merged, it did correctly fix a situation where a FILE read
operation on the middle of a file buffer would not read the requested length
in the parameters passed to the FILE function. Unfortunately, it would also
allow the FILE function to append more bytes than what was available in the
buffer if the length exceeded the end of the buffer length.

This patch takes the minimum of the remaining bytes in the buffer along with
the calculated length to append provided by the original patch, and uses
that as the length to append in the return result. This patch also updates
the unit tests with the scenarios that were originally pointed out in
ASTERISK-21765 that the original implementation treated incorrectly.

ASTERISK-21765

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
funcs/func_env.c
tests/test_func_file.c