diff options
author | ranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2011-01-06 14:41:10 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-31 16:03:10 +0200 |
commit | 1c37a03ac6cdf7243e3781eef9c8beae777c1040 (patch) | |
tree | f6e6a31a1467fb40780da93969c15c8a5e547890 /libmpdemux | |
parent | 2ce17b5afdbd7cd80290c4d9aa5c0aa78c9325d2 (diff) | |
download | mpv-1c37a03ac6cdf7243e3781eef9c8beae777c1040.tar.bz2 mpv-1c37a03ac6cdf7243e3781eef9c8beae777c1040.tar.xz |
libmpdemux/mf.c: Don't hardcode filename length
Use limits.h to get the maximum length instead of hardcoding it.
Original patch by Sang-Uok Kum.
Signed-off-by: Tobias Diedrich <ranma@google.com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32766 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/mf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libmpdemux/mf.c b/libmpdemux/mf.c index c8d64313b0..3127176f6e 100644 --- a/libmpdemux/mf.c +++ b/libmpdemux/mf.c @@ -23,6 +23,7 @@ #include <unistd.h> #include <fcntl.h> #include <errno.h> +#include <limits.h> #include <sys/types.h> #include <sys/stat.h> @@ -62,8 +63,8 @@ mf_t* open_mf(char * filename){ FILE *lst_f=fopen(filename + 1,"r"); if ( lst_f ) { - fname=malloc( 255 ); - while ( fgets( fname,255,lst_f ) ) + fname=malloc(PATH_MAX); + while ( fgets( fname,PATH_MAX,lst_f ) ) { /* remove spaces from end of fname */ char *t=fname + strlen( fname ) - 1; |