aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--formats/format_jpeg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/formats/format_jpeg.c b/formats/format_jpeg.c
index d71aeec80..96fed0dea 100644
--- a/formats/format_jpeg.c
+++ b/formats/format_jpeg.c
@@ -55,7 +55,7 @@ static struct ast_frame *jpeg_read_image(int fd, int len)
struct ast_frame fr;
int res;
char buf[65536];
- if (len > sizeof(buf)) {
+ if (len > sizeof(buf) || len < 0) {
ast_log(LOG_WARNING, "JPEG image too large to read\n");
return NULL;
}