aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-01 16:45:14 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-01 16:45:14 +0000
commit1e2dfec8f61c985cc9c393a947232cc75e2e6693 (patch)
tree23df1d0e1c5881c1943ad59f2f3540e1ed14a672 /main
parentefc7a3c37c5bdde1f68295d651cb237d169c03e4 (diff)
Ensure that we do not exceed the hold's maximum size with a single frame.
(closes issue #12047) Reported by: fabianoheringer Tested by: fabianoheringer git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@112125 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/slinfactory.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/slinfactory.c b/main/slinfactory.c
index df1af3738..0022c62de 100644
--- a/main/slinfactory.c
+++ b/main/slinfactory.c
@@ -137,6 +137,9 @@ int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
memcpy(offset, frame_data, ineed * sizeof(*offset));
sofar += ineed;
frame_data += ineed;
+ if (remain > (AST_SLINFACTORY_MAX_HOLD - sf->holdlen)) {
+ remain = AST_SLINFACTORY_MAX_HOLD - sf->holdlen;
+ }
memcpy(sf->hold, frame_data, remain * sizeof(*offset));
sf->holdlen = remain;
}