[vlc-devel] [PATCH] vlc_url: i_port is now a uint16_t

Thomas Guillem thomas at gllm.fr
Wed Feb 10 15:54:12 CET 2016


---
 include/vlc_url.h | 2 +-
 src/text/url.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/vlc_url.h b/include/vlc_url.h
index 4abe0da..38085f7 100644
--- a/include/vlc_url.h
+++ b/include/vlc_url.h
@@ -108,7 +108,7 @@ struct vlc_url_t
     char *psz_username;
     char *psz_password;
     char *psz_host;
-    unsigned i_port;
+    uint16_t i_port;
     char *psz_path;
     char *psz_option;
 
diff --git a/src/text/url.c b/src/text/url.c
index b9ed274..ae16bd0 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -25,6 +25,7 @@
 
 #include <errno.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <assert.h>
 #ifdef _WIN32
@@ -415,7 +416,11 @@ void vlc_UrlParse (vlc_url_t *restrict url, const char *str)
 
     /* Port number */
     if (next != NULL)
-        url->i_port = atoi (next);
+    {
+        int i_port = atoi (next);
+        if (i_port > 0 && i_port <= UINT16_MAX )
+            url->i_port = i_port;
+    }
 
     if (url->psz_path != NULL)
         *url->psz_path = '/'; /* restore leading slash */
-- 
2.7.0.rc3



More information about the vlc-devel mailing list