]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a memory copying bug in slinfactory which was causing mixmonitor issues.
authorJonathan Rose <jrose@digium.com>
Tue, 28 May 2013 17:35:12 +0000 (17:35 +0000)
committerJonathan Rose <jrose@digium.com>
Tue, 28 May 2013 17:35:12 +0000 (17:35 +0000)
Reported by: Michael Walton
Tested by: Jonathan Rose
Patches:
    slinfactory.c.ASTERISK-21799.patch uploaded by Michael Walton (license 6502)
(closes issue ASTERISK-21799)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@389895 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/slinfactory.c

index e18230a54fcc95121dacd166cfd1e40e883ac6fe..7fd2462a3f9cb811f27266aad2866a937e707e06 100644 (file)
@@ -139,7 +139,7 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
        return x;
 }
 
-int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples) 
+int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
 {
        struct ast_frame *frame_ptr;
        unsigned int sofar = 0, ineed, remain;
@@ -150,7 +150,7 @@ int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
 
                if (sf->holdlen) {
                        if (sf->holdlen <= ineed) {
-                               memcpy(offset, sf->hold, sf->holdlen * sizeof(*offset));
+                               memcpy(offset, sf->offset, sf->holdlen * sizeof(*offset));
                                sofar += sf->holdlen;
                                offset += sf->holdlen;
                                sf->holdlen = 0;
@@ -164,10 +164,10 @@ int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
                        }
                        continue;
                }
-               
+
                if ((frame_ptr = AST_LIST_REMOVE_HEAD(&sf->queue, frame_list))) {
                        frame_data = frame_ptr->data.ptr;
-                       
+
                        if (frame_ptr->samples <= ineed) {
                                memcpy(offset, frame_data, frame_ptr->samples * sizeof(*offset));
                                sofar += frame_ptr->samples;