aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-02-06 16:52:57 -0800
committerFlorin Coras <fcoras@cisco.com>2022-02-06 16:58:04 -0800
commit7463900dbd8df07c384e8a8017ec0392309efee6 (patch)
tree409498a0712522ab72622f8c7cf8e662e92c1e6a
parent7a2574a8ca4bf378e876df40c6e8d290d53d5f7e (diff)
http_static: fix coverity warning
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I6d5527c49e9085f35be988549c2f1460be7fd4f0
-rw-r--r--src/plugins/http_static/static_server.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index 48a33107926..0a1eb356fe8 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -319,7 +319,7 @@ try_url_handler (hss_main_t *hsm, hss_session_t *hs, http_req_method_t rt,
uword *p, *url_table;
int rv;
- if (!hsm->enable_url_handlers)
+ if (!hsm->enable_url_handlers || !request)
return -1;
/* Look for built-in GET / POST handlers */
@@ -389,7 +389,9 @@ handle_request (hss_session_t *hs, http_req_method_t rt, u8 *request)
* Construct the file to open
* Browsers are capable of sporadically including a leading '/'
*/
- if (request[0] == '/')
+ if (!request)
+ path = format (0, "%s%c", hsm->www_root, 0);
+ else if (request[0] == '/')
path = format (0, "%s%s%c", hsm->www_root, request, 0);
else
path = format (0, "%s/%s%c", hsm->www_root, request, 0);