[vlc-commits] securetransport: remove wrong check in recv function

David Fuhrmann git at videolan.org
Tue Jan 5 17:41:32 CET 2016


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Tue Jan  5 17:38:32 2016 +0100| [000d5d3f23c33f3b17b712a29b0d9501287c9812] | committer: David Fuhrmann

securetransport: remove wrong check in recv function

sys should always be set (but lets assert if not), buf == NULL
should not be called from VLC as well. And the return value was
kind of wrong.

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

 modules/misc/securetransport.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/misc/securetransport.c b/modules/misc/securetransport.c
index 674b9b8..387d2cd 100644
--- a/modules/misc/securetransport.c
+++ b/modules/misc/securetransport.c
@@ -428,6 +428,7 @@ static int st_Handshake (vlc_tls_creds_t *crd, vlc_tls_t *session,
 static ssize_t st_Send (vlc_tls_t *session, const void *buf, size_t length)
 {
     vlc_tls_sys_t *sys = session->sys;
+    assert(sys);
     OSStatus ret = noErr;
 
     /*
@@ -481,9 +482,7 @@ static ssize_t st_Send (vlc_tls_t *session, const void *buf, size_t length)
 static ssize_t st_Recv (vlc_tls_t *session, void *buf, size_t length)
 {
     vlc_tls_sys_t *sys = session->sys;
-
-    if (sys == NULL || buf == NULL)
-        return 0;
+    assert(sys);
 
     size_t actualSize;
     OSStatus ret = SSLRead(sys->p_context, buf, length, &actualSize);



More information about the vlc-commits mailing list