[vlc-commits] vlc_credential: fix url check
Thomas Guillem
git at videolan.org
Mon Feb 29 11:56:52 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb 29 11:39:41 2016 +0100| [1973059acd27d3055b91501c22bfca30ec4f9110] | committer: Thomas Guillem
vlc_credential: fix url check
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1973059acd27d3055b91501c22bfca30ec4f9110
---
src/misc/keystore.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index 977f30b..222ffb8 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -202,6 +202,13 @@ is_credential_valid(vlc_credential *p_credential)
}
+static bool
+is_url_valid(const vlc_url_t *p_url)
+{
+ return p_url && p_url->psz_protocol && p_url->psz_protocol[0]
+ && p_url->psz_host && p_url->psz_host[0];
+}
+
/* Default port for each protocol */
static struct
{
@@ -370,7 +377,7 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
assert(p_credential && p_parent);
const vlc_url_t *p_url = p_credential->p_url;
- if (!p_url || !p_url->psz_protocol || !p_url->psz_host)
+ if (!is_url_valid(p_url))
{
msg_Err(p_parent, "vlc_credential_get: invalid url");
return false;
More information about the vlc-commits
mailing list