[vlc-commits] [Git][videolan/vlc][master] 8 commits: http: use const vlc_url_t pointers
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Nov 3 15:26:07 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e4b05476 by Steve Lhomme at 2026-11-03T15:02:18+00:00
http: use const vlc_url_t pointers
- - - - -
d22a0507 by Steve Lhomme at 2026-11-03T15:02:18+00:00
nfs: use const vlc_url_t pointer
- - - - -
2e05cb98 by Steve Lhomme at 2026-11-03T15:02:18+00:00
audioscrobbler: use const vlc_url_t pointer
- - - - -
6c477a62 by Steve Lhomme at 2026-11-03T15:02:18+00:00
mms: use const vlc_url_t pointer
- - - - -
4b6db1e2 by Steve Lhomme at 2026-11-03T15:02:18+00:00
vlc_url: use a void * for the URL buffers to free
So they are not used as strings.
- - - - -
80626adb by Steve Lhomme at 2026-11-03T15:02:18+00:00
access: ftp: remove redundant test
We already checked that the pointer is not NULL.
- - - - -
cb939505 by Steve Lhomme at 2026-11-03T15:02:18+00:00
VLCInputItem: check URL errors and fix potential leaks
- - - - -
c6d1df39 by Steve Lhomme at 2026-11-03T15:02:18+00:00
lua: check vlc_uri_decode() errors
- - - - -
8 changed files:
- include/vlc_url.h
- modules/access/ftp.c
- modules/access/http.c
- modules/access/mms/mmstu.c
- modules/access/nfs.c
- modules/gui/macosx/library/VLCInputItem.m
- modules/lua/libs/input.c
- modules/misc/audioscrobbler.c
Changes:
=====================================
include/vlc_url.h
=====================================
@@ -152,8 +152,8 @@ struct vlc_url_t
char *psz_option;
char *psz_fragment;
- char *psz_buffer; /* to be freed */
- char *psz_pathbuffer; /* to be freed */
+ void *psz_buffer; /* to be freed */
+ void *psz_pathbuffer; /* to be freed */
};
/**
=====================================
modules/access/ftp.c
=====================================
@@ -691,11 +691,8 @@ static int parseURL( vlc_object_t *p_obj, vlc_url_t *url, const char *path, enum
/* FTP URLs are relative to user's default directory (RFC1738 §3.2)
For absolute path use ftp://foo.bar//usr/local/etc/filename */
/* FIXME: we should issue a series of CWD, one per slash */
- if( url->psz_path )
- {
- assert( url->psz_path[0] == '/' );
- url->psz_path++;
- }
+ assert( url->psz_path[0] == '/' );
+ url->psz_path++;
char *type = strstr( url->psz_path, ";type=" );
if( type )
=====================================
modules/access/http.c
=====================================
@@ -129,7 +129,7 @@ static void Disconnect( stream_t * );
static int AuthCheckReply( stream_t *p_access, const char *psz_header,
- vlc_url_t *p_url, vlc_http_auth_t *p_auth );
+ const vlc_url_t *p_url, vlc_http_auth_t *p_auth );
/*****************************************************************************
* Open:
@@ -615,7 +615,7 @@ static int Control( stream_t *p_access, int i_query, va_list args )
static int Connect( stream_t *p_access )
{
access_sys_t *p_sys = p_access->p_sys;
- vlc_url_t srv = p_sys->b_proxy ? p_sys->proxy : p_sys->url;
+ const vlc_url_t *srv = p_sys->b_proxy ? &p_sys->proxy : &p_sys->url;
ssize_t val;
/* Clean info */
@@ -707,10 +707,10 @@ static int Connect( stream_t *p_access )
/* Open connection */
assert(p_sys->stream == NULL); /* No open sockets (leaking fds is BAD) */
p_sys->stream = vlc_tls_SocketOpenTCP(VLC_OBJECT(p_access),
- srv.psz_host, srv.i_port);
+ srv->psz_host, srv->i_port);
if (p_sys->stream == NULL)
{
- msg_Err( p_access, "cannot connect to %s:%d", srv.psz_host, srv.i_port );
+ msg_Err( p_access, "cannot connect to %s:%d", srv->psz_host, srv->i_port );
free( stream.ptr );
return -1;
}
@@ -977,7 +977,7 @@ static void Disconnect( stream_t *p_access )
*****************************************************************************/
static int AuthCheckReply( stream_t *p_access, const char *psz_header,
- vlc_url_t *p_url, vlc_http_auth_t *p_auth )
+ const vlc_url_t *p_url, vlc_http_auth_t *p_auth )
{
return
vlc_http_auth_ParseAuthenticationInfoHeader( VLC_OBJECT(p_access),
=====================================
modules/access/mms/mmstu.c
=====================================
@@ -71,7 +71,7 @@ static block_t *Block( stream_t *, bool * );
static int Seek( stream_t *, uint64_t );
static int Control( stream_t *, int, va_list );
-static int MMSOpen ( stream_t *, vlc_url_t *, int );
+static int MMSOpen ( stream_t *, const vlc_url_t *, int );
static int MMSStart( stream_t *, uint32_t );
static int MMSStop ( stream_t * );
static void MMSClose( stream_t * );
@@ -474,7 +474,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
/****************************************************************************
* MMSOpen : Open a connection with the server over mmst or mmsu
****************************************************************************/
-static int MMSOpen( stream_t *p_access, vlc_url_t *p_url, int i_proto )
+static int MMSOpen( stream_t *p_access, const vlc_url_t *p_url, int i_proto )
{
access_sys_t *p_sys = p_access->p_sys;
int b_udp = ( i_proto == MMS_PROTO_UDP ) ? 1 : 0;
=====================================
modules/access/nfs.c
=====================================
@@ -314,7 +314,7 @@ FileControl(stream_t *p_access, int i_query, va_list args)
}
static char *
-NfsGetUrl(vlc_url_t *p_url, const char *psz_file)
+NfsGetUrl(const vlc_url_t *p_url, const char *psz_file)
{
/* nfs://<psz_host><psz_path><psz_file>?<psz_option> */
char *psz_url;
=====================================
modules/gui/macosx/library/VLCInputItem.m
=====================================
@@ -297,7 +297,15 @@ static const struct input_item_parser_cbs_t parserCallbacks =
- (NSString *)decodedMRL
{
- char *psz_url = vlc_uri_decode(input_item_GetURI(_vlcInputItem));
+ char *uri = input_item_GetURI(_vlcInputItem);
+ if (uri == NULL)
+ return @"";
+ char *psz_url = vlc_uri_decode(uri);
+ if (psz_url == NULL)
+ {
+ free(uri);
+ return @"";
+ }
NSString *returnValue = toNSStr(psz_url);
FREENULL(psz_url);
return returnValue;
=====================================
modules/lua/libs/input.c
=====================================
@@ -544,7 +544,13 @@ static int vlclua_input_metas_internal( lua_State *L, input_item_t *p_item )
if( psz_filename )
{
/* url decode, without leading slash */
- psz_filename = vlc_uri_decode( psz_filename + 1 );
+ char* decoded = vlc_uri_decode( psz_filename + 1 );
+ if (unlikely(decoded == NULL))
+ {
+ free( psz_uri );
+ return vlclua_error( L );
+ }
+ psz_filename = decoded;
}
lua_pushstring( L, psz_filename );
=====================================
modules/misc/audioscrobbler.c
=====================================
@@ -752,7 +752,7 @@ static void *Run(void *data)
}
msg_Dbg(p_intf, "Going to submit some data...");
- vlc_url_t *url;
+ const vlc_url_t *url;
struct vlc_memstream req, payload;
vlc_memstream_open(&payload);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5c8ca8c49a606d4a59553b9f77dfdf78da241037...c6d1df39c7a52ff2caa582521ca61db081fa525e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5c8ca8c49a606d4a59553b9f77dfdf78da241037...c6d1df39c7a52ff2caa582521ca61db081fa525e
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list