[vlc-commits] url: fix potential segmentation fault in test case

Rémi Denis-Courmont git at videolan.org
Thu Aug 27 20:38:20 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 27 19:18:40 2015 +0300| [623d18e6c0f0c3638b1ed4788bb1f9640416bb57] | committer: Rémi Denis-Courmont

url: fix potential segmentation fault in test case

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

 src/test/url.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/test/url.c b/src/test/url.c
index 698a45c..8b041d0 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -92,7 +92,12 @@ static void test_url_parse(const char* in, const char* protocol, const char* use
                            const char* pass, const char* host, unsigned i_port,
                            const char* path, const char* option )
 {
-#define CHECK( a, b ) assert(((a == NULL) && (b == NULL)) || !strcmp((a), (b)))
+#define CHECK( a, b ) \
+    if (a == NULL) \
+        assert(b == NULL); \
+    else \
+        assert(b != NULL && !strcmp((a), (b)))
+
     vlc_url_t url;
     vlc_UrlParse( &url, in, '?' );
     CHECK( url.psz_protocol, protocol );



More information about the vlc-commits mailing list