aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/channel.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 41748df76..9f0ae7abe 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3012,6 +3012,17 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_frame_dump(chan->name, f, "<<");
chan->fin = FRAMECOUNT_INC(chan->fin);
+ if (f && f->datalen == 0 && f->data.ptr) {
+ /* fix invalid pointer */
+ f->data.ptr = NULL;
+#ifdef AST_DEVMODE
+ ast_log(LOG_ERROR, "Found frame with src '%s' on channel '%s' with datalen zero, but non-null data pointer!\n", f->src, chan->name);
+ ast_frame_dump(chan->name, f, "<<");
+#else
+ ast_debug(3, "Found frame with src '%s' on channel '%s' with datalen zero, but non-null data pointer!\n", f->src, chan->name);
+#endif
+ }
+
done:
if (chan->music_state && chan->generator && chan->generator->digit && f && f->frametype == AST_FRAME_DTMF_END)
chan->generator->digit(chan, f->subclass);