[vlc-devel] [PATCH] problem with osdmenu-parser when using the osdmenu-file-path -setting
Jean-Paul Saman
jean-paul.saman at planet.nl
Sat Sep 29 13:53:54 CEST 2007
> ------------------------------------------------------------------------
>
> --- src/osd/osd_parser.c Sat Sep 8 14:48:29 2007
> +++ src/osd/osd_parser.c Tue Sep 18 18:33:08 2007
> @@ -340,13 +340,12 @@
> size_t i_len = 0;
> long pos = 0;
>
> + /* read images path */
> + result = fscanf(fd, "%24s %255s", &action[0], &path[0] );
> +
> /* override images path ? */
> psz_path = config_GetPsz( p_this, "osdmenu-file-path" );
> - if( psz_path == NULL )
> - {
> - result = fscanf(fd, "%24s %255s", &action[0], &path[0] );
> - }
> - else
> + if( psz_path != NULL )
Above change seems ok to me. Already applied it.
> @@ -361,10 +360,10 @@
> if( i_len == MAX_FILE_PATH )
> i_len--; /* truncate to prevent buffer overflow */
> #if defined(WIN32) || defined(UNDER_CE)
> - if( (i_len > 0) && path[i_len] != '\\' )
> + if( (i_len > 0) && path[i_len-1] != '\\' && path[i_len-1] != '/' )
This is wrong we are dealing with windows here and having a / in your
filename/path is your own problem.
> path[i_len] = '\\';
> #else
> - if( (i_len > 0) && path[i_len] != '/' )
> + if( (i_len > 0) && path[i_len-1] != '/' )
> path[i_len] = '/';
> #endif
> path[i_len+1] = '\0';
Using i_len-1 is wrong too here, because strlen(&path[0]) returns the
number of characters without the termination '\0'. Thus &path[i_len]
effectively points to the last character in this string.
Gtz,
Jean-Paul Saman.
More information about the vlc-devel
mailing list