[vlc-commits] network: net_OpenDgram() doesn't accept a negative ports

Steve Lhomme git at videolan.org
Wed Jul 11 15:35:17 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 11 14:55:34 2018 +0200| [0294057b15132d376fe1c68eaa26f940adc5e936] | committer: Steve Lhomme

network: net_OpenDgram() doesn't accept a negative ports

vlc_getaddrinfo() takes an unsigned port anyway

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0294057b15132d376fe1c68eaa26f940adc5e936
---

 include/vlc_network.h | 4 ++--
 src/network/udp.c     | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/vlc_network.h b/include/vlc_network.h
index eb6a93aa51..c952c627e4 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -150,11 +150,11 @@ static inline int net_ConnectUDP (vlc_object_t *obj, const char *host, int port,
     return net_ConnectDgram (obj, host, port, hlim, IPPROTO_UDP);
 }
 
-VLC_API int net_OpenDgram( vlc_object_t *p_this, const char *psz_bind, int i_bind, const char *psz_server, int i_server, int proto );
+VLC_API int net_OpenDgram( vlc_object_t *p_this, const char *psz_bind, unsigned i_bind, const char *psz_server, unsigned i_server, int proto );
 #define net_OpenDgram( a, b, c, d, e, g ) \
         net_OpenDgram(VLC_OBJECT(a), b, c, d, e, g)
 
-static inline int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port)
+static inline int net_ListenUDP1 (vlc_object_t *obj, const char *host, unsigned port)
 {
     return net_OpenDgram (obj, host, port, NULL, 0, IPPROTO_UDP);
 }
diff --git a/src/network/udp.c b/src/network/udp.c
index 660e6d6c47..71b657f1ae 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -139,7 +139,7 @@ static int net_SetupDgramSocket (vlc_object_t *p_obj, int fd,
 }
 
 /* */
-static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
+static int net_ListenSingle (vlc_object_t *obj, const char *host, unsigned port,
                              int protocol)
 {
     struct addrinfo hints = {
@@ -598,8 +598,8 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
  *****************************************************************************
  * OpenDgram a datagram socket and return a handle
  *****************************************************************************/
-int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
-                   const char *psz_server, int i_server, int protocol )
+int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, unsigned i_bind,
+                   const char *psz_server, unsigned i_server, int protocol )
 {
     if ((psz_server == NULL) || (psz_server[0] == '\0'))
         return net_ListenSingle (obj, psz_bind, i_bind, protocol);



More information about the vlc-commits mailing list