[vlc-commits] network: net_ConnectDgram() doesn't accept a negative port

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 11 15:00:06 2018 +0200| [a1442259134d18e26d42fe70738ca4f937a12fb4] | committer: Steve Lhomme

network: net_ConnectDgram() doesn't accept a negative port

vlc_getaddrinfo() takes an unsigned port anyway

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

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

diff --git a/include/vlc_network.h b/include/vlc_network.h
index c952c627e4..a667d62cef 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -141,11 +141,11 @@ VLC_API int net_Accept( vlc_object_t *, int * );
 #define net_Accept(a, b) \
         net_Accept(VLC_OBJECT(a), b)
 
-VLC_API int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port, int hlim, int proto );
+VLC_API int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, unsigned i_port, int hlim, int proto );
 #define net_ConnectDgram(a, b, c, d, e ) \
         net_ConnectDgram(VLC_OBJECT(a), b, c, d, e)
 
-static inline int net_ConnectUDP (vlc_object_t *obj, const char *host, int port, int hlim)
+static inline int net_ConnectUDP (vlc_object_t *obj, const char *host, unsigned port, int hlim)
 {
     return net_ConnectDgram (obj, host, port, hlim, IPPROTO_UDP);
 }
diff --git a/src/network/udp.c b/src/network/udp.c
index 71b657f1ae..cd8c434037 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -513,7 +513,7 @@ static int net_SetDSCP( int fd, uint8_t dscp )
  * Open a datagram socket to send data to a defined destination, with an
  * optional hop limit.
  *****************************************************************************/
-int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
+int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, unsigned i_port,
                       int i_hlim, int proto )
 {
     struct addrinfo hints = {



More information about the vlc-commits mailing list