Index: apps/app_milliwatt.c
===================================================================
--- apps/app_milliwatt.c	(revision 359614)
+++ apps/app_milliwatt.c	(revision 359615)
@@ -77,7 +77,7 @@
 static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
 {
 	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
-	const int maxsamples = sizeof (buf) / sizeof (buf[0]);
+	const int maxsamples = (sizeof (buf) / sizeof (buf[0])) - (AST_FRIENDLY_OFFSET / sizeof(buf[0]));
 	int i, *indexp = (int *) data;
 	struct ast_frame wf = {
 		.frametype = AST_FRAME_VOICE,
