summaryrefslogtreecommitdiffstats
path: root/libmpdemux/cookies.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpdemux/cookies.c')
-rw-r--r--libmpdemux/cookies.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libmpdemux/cookies.c b/libmpdemux/cookies.c
index 65745872d2..3a828f8d5e 100644
--- a/libmpdemux/cookies.c
+++ b/libmpdemux/cookies.c
@@ -12,6 +12,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
+#include <inttypes.h>
#include "cookies.h"
#include "http.h"
@@ -110,6 +111,11 @@ static char *load_file(const char *filename, off_t * length)
return NULL;
}
+ if (*length > SIZE_MAX - 1) {
+ mp_msg(MSGT_NETWORK, MSGL_V, "File too big, could not malloc.");
+ return NULL;
+ }
+
lseek(fd, SEEK_SET, 0);
if (!(buffer = malloc(*length + 1))) {