[vlc-commits] httpd: Fix leak in case of dubious requet headers

Hugo Beauzée-Luyssen git at videolan.org
Wed Jun 27 11:25:03 CEST 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Jun 27 11:16:56 2018 +0200| [80e6e93afa4001d0c3df988ecec13fdc86282cc6] | committer: Hugo Beauzée-Luyssen

httpd: Fix leak in case of dubious requet headers

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

 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 65e718a197..ce2b6a8163 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1452,10 +1452,12 @@ static void httpd_ClientRecv(httpd_client_t *cl)
                         }
                     }
 
-                    cl->query.psz_url = strdup(p);
-                    if ((p3 = strchr(cl->query.psz_url, '?')) ) {
-                        *p3++ = '\0';
-                        cl->query.psz_args = (uint8_t *)strdup(p3);
+                    if(cl->query.psz_url == NULL) {
+                        cl->query.psz_url = strdup(p);
+                        if ((p3 = strchr(cl->query.psz_url, '?')) ) {
+                            *p3++ = '\0';
+                            cl->query.psz_args = (uint8_t *)strdup(p3);
+                        }
                     }
                     p = p2;
                 }



More information about the vlc-commits mailing list