From 89dca4588fc4cee33b59d3ec6f1d1e0c435d0f5d Mon Sep 17 00:00:00 2001 From: Mike Kleshov Date: Wed, 27 Jan 2021 19:28:19 +0300 Subject: [PATCH] httpd: follow-up to previous commit, replace strstr() with memcmp() --- src/apps/http/httpd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/http/httpd.c b/src/apps/http/httpd.c index 80a005d9..66c7723b 100644 --- a/src/apps/http/httpd.c +++ b/src/apps/http/httpd.c @@ -874,11 +874,11 @@ get_http_headers(struct http_state *hs, const char *uri) special case. We assume that any filename with "404" in it must be indicative of a 404 server error whereas all other files require the 200 OK header. */ - if (strstr(uri, "/404.") == uri) { + if (memcmp(uri, "/404.", 5) == 0) { hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_FOUND]; - } else if (strstr(uri, "/400.") == uri) { + } else if (memcmp(uri, "/400.", 5) == 0) { hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_BAD_REQUEST]; - } else if (strstr(uri, "/501.") == uri) { + } else if (memcmp(uri, "/501.", 5) == 0) { hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_IMPL]; } else { hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_OK];