Index: apps/app_sms.c =================================================================== --- apps/app_sms.c (revision 28893) +++ apps/app_sms.c (working copy) @@ -1176,14 +1176,14 @@ static int sms_generate (struct ast_channel *chan, void *data, int len, int samples) { struct ast_frame f = { 0 }; - unsigned char waste[AST_FRIENDLY_OFFSET]; #define MAXSAMPLES (800) #ifdef OUTALAW - unsigned char buf[MAXSAMPLES]; +#define SAMPLE2LEN 1 + unsigned char *buf; #else - signed short buf[MAXSAMPLES]; +#define SAMPLE2LEN 2 + short *buf; #endif -#define SAMPLE2LEN (sizeof (buf[0])) sms_t *h = data; int i; @@ -1192,9 +1192,9 @@ MAXSAMPLES, samples); samples = MAXSAMPLES; } - len = samples * SAMPLE2LEN; + len = samples * SAMPLE2LEN + AST_FRIENDLY_OFFSET; + buf = alloca(len); - waste[0] = 0; /* make compiler happy */ f.frametype = AST_FRAME_VOICE; #ifdef OUTALAW f.subclass = AST_FORMAT_ALAW; @@ -1204,7 +1204,7 @@ f.datalen = len; f.offset = AST_FRIENDLY_OFFSET; f.mallocd = 0; - f.data = buf; + f.data = buf + AST_FRIENDLY_OFFSET; f.samples = samples; f.src = "app_sms"; /* create a buffer containing the digital sms pattern */