summaryrefslogtreecommitdiffstats
path: root/libmpdemux/url.c
diff options
context:
space:
mode:
authorrtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-06-04 22:41:27 +0000
committerrtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-06-04 22:41:27 +0000
commit9da93175794398fefeb45c6c53abdcdeda325101 (patch)
tree1dad782a7785b845d9bfc950631e91c01369154b /libmpdemux/url.c
parentb4ddc383ef4e4d537417999e390ab90631e7b6aa (diff)
downloadmpv-9da93175794398fefeb45c6c53abdcdeda325101.tar.bz2
mpv-9da93175794398fefeb45c6c53abdcdeda325101.tar.xz
Fix potential integer overflows in memory allocation.
Patch by Rich and me git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18559 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/url.c')
-rw-r--r--libmpdemux/url.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libmpdemux/url.c b/libmpdemux/url.c
index b752ce5c8a..97cdbdb5d3 100644
--- a/libmpdemux/url.c
+++ b/libmpdemux/url.c
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
+#include <inttypes.h>
#include "url.h"
#include "mp_msg.h"
@@ -24,6 +25,10 @@ url_new(const char* url) {
if( url==NULL ) return NULL;
+ if (strlen(url) > (SIZE_MAX / 3 - 1)) {
+ mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ goto err_out;
+ }
escfilename=malloc(strlen(url)*3+1);
if (!escfilename ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);