[svn-commits] trunk - r8233 in /trunk: ./ apps/app_milliwatt.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Jan 18 21:21:15 MST 2006
Author: russell
Date: Wed Jan 18 22:21:12 2006
New Revision: 8233
URL: http://svn.digium.com/view/asterisk?rev=8233&view=rev
Log:
Merged revisions 8232 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r8232 | russell | 2006-01-18 23:17:45 -0500 (Wed, 18 Jan 2006) | 3 lines
fix a seg fault due to assuming that space gets allocatted on the stack in the
same order that we declare the variables (issue #6290)
........
Modified:
trunk/ (props changed)
trunk/apps/app_milliwatt.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: trunk/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_milliwatt.c?rev=8233&r1=8232&r2=8233&view=diff
==============================================================================
--- trunk/apps/app_milliwatt.c (original)
+++ trunk/apps/app_milliwatt.c Wed Jan 18 22:21:12 2006
@@ -72,30 +72,29 @@
static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
{
struct ast_frame wf;
- unsigned char waste[AST_FRIENDLY_OFFSET];
- unsigned char buf[640];
+ unsigned char buf[AST_FRIENDLY_OFFSET + 640];
int i,*indexp = (int *) data;
- if (len > sizeof(buf))
+ if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
{
- ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)sizeof(buf),len);
- len = sizeof(buf);
+ ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
+ len = sizeof(buf) - AST_FRIENDLY_OFFSET;
}
- waste[0] = 0; /* make compiler happy */
wf.frametype = AST_FRAME_VOICE;
wf.subclass = AST_FORMAT_ULAW;
wf.offset = AST_FRIENDLY_OFFSET;
wf.mallocd = 0;
- wf.data = buf;
+ wf.data = buf + AST_FRIENDLY_OFFSET;
wf.datalen = len;
wf.samples = wf.datalen;
wf.src = "app_milliwatt";
wf.delivery.tv_sec = 0;
wf.delivery.tv_usec = 0;
+ wf.prev = wf.next = NULL;
/* create a buffer containing the digital milliwatt pattern */
for(i = 0; i < len; i++)
{
- buf[i] = digital_milliwatt[(*indexp)++];
+ buf[AST_FRIENDLY_OFFSET + i] = digital_milliwatt[(*indexp)++];
*indexp &= 7;
}
if (ast_write(chan,&wf) < 0)
More information about the svn-commits
mailing list