]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/app: Only look to end of file if ':end' is specified, and not just ':' 17/2317/3
authorMatt Jordan <mjordan@digium.com>
Mon, 29 Feb 2016 01:05:16 +0000 (19:05 -0600)
committerJoshua Colp <jcolp@digium.com>
Wed, 23 Mar 2016 16:53:31 +0000 (13:53 -0300)
There is a little known feature in app_controlplayback that will cause the
specified offset to be used relative to the end of a file if a ':end' is
detected within the filename.

This feature is pretty bad, but okay.

However, a bug exists in this code where a ':' detected in the filename
will cause the end pointer to be non-NULL, even if the full ':end' isn't
specified. This causes us to treat an unspecified offset (0) as being
"start playing from the end of the file", resulting in no file playback
occurring.

This patch fixes this bug by resetting the end pointer if ':end' is not
found in the filename.

Change-Id: Ib4c7b1b45283e4effd622a970055c51146892f35

main/app.c

index 826e41128c9b6a05704c86803ba7584502e679e6..e1d70498cf342729b6f8e6a9ab2997a0d49e230f 100644 (file)
@@ -1112,6 +1112,8 @@ static int control_streamfile(struct ast_channel *chan,
                if (!strcasecmp(end, ":end")) {
                        *end = '\0';
                        end++;
+               } else {
+                       end = NULL;
                }
        }