[vlc-devel] [PATCH 05/15] httpd: Fix potential null-dereference in case of error

David Loiret loiret.d at gmail.com
Tue Jun 23 14:42:40 CEST 2020


From: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

---
 src/network/httpd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index e11c9aab99..b2267e5de2 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -424,10 +424,12 @@ httpd_HandlerCallBack(httpd_callback_sys_t *p_sys, httpd_client_t *cl,
         *psz_remote_addr = '\0';
 
     uint8_t *psz_args = query->psz_args;
-    handler->pf_fill(handler->p_sys, handler, query->psz_url, psz_args,
-                      query->i_type, query->p_body, query->i_body,
-                      psz_remote_addr, NULL,
-                      &answer->p_body, &answer->i_body);
+    if ( handler->pf_fill(handler->p_sys, handler, query->psz_url, psz_args,
+                          query->i_type, query->p_body, query->i_body,
+                          psz_remote_addr, NULL,
+                          &answer->p_body, &answer->i_body) != VLC_SUCCESS)
+        return VLC_EGENERIC;
+
 
     if (query->i_type == HTTPD_MSG_HEAD) {
         char *p = (char *)answer->p_body;
-- 
2.18.0



More information about the vlc-devel mailing list