[vlc-devel] [PATCH] network: fix clamping (cid #1420607)

Tristan Matthews tmatth at videolan.org
Mon Nov 6 06:21:27 CET 2017


---
 src/network/tcp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/network/tcp.c b/src/network/tcp.c
index bc2a116532..51b275d238 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -177,9 +177,7 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
 
                 if (deadline != VLC_TS_INVALID)
                 {
-                    ms = (deadline - mdate()) / (CLOCK_FREQ / 1000);
-                    if (ms > INT_MAX)
-                        ms = INT_MAX;
+                    ms = __MIN((deadline - mdate()) / (CLOCK_FREQ / 1000), INT_MAX);
                 }
 
                 val = vlc_poll_i11e(&ufd, 1, ms);
-- 
2.15.0



More information about the vlc-devel mailing list