diff --git a/rtp.c b/rtp.c
index 02b30bc6fd115bf3001c6c04ba90c4e6455e740e..44680683e7f46697927ffaccead9fae5cbaacf44 100755
--- a/rtp.c
+++ b/rtp.c
@@ -452,6 +452,11 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
 		hdrlen += (rtpheader[3] & 0xffff) << 2;
 	}
 
+	if (res < hdrlen) {
+		ast_log(LOG_WARNING, "RTP Read too short (%d, expecting %d)\n", res, hdrlen);
+		return &null_frame;
+	}
+
 #if 0
 	printf("Got RTP packet from %s:%d (type %d, seq %d, ts %d, len = %d)\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
 #endif