From 5a7a75743121164a9b6e12011e2bd7ce6ceab1c5 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 12 Feb 2024 10:27:35 +0100 Subject: [PATCH] MT#59038 Fix a defect detected by Coverity Scan (websocket) Fix for: *** CID 1583599: Code maintainability issues (UNUSED_VALUE) /daemon/websocket.c: 668 in websocket_http_body() 662 return 0; 663 } 664 665 ilogs(http, LOG_DEBUG, "HTTP body complete: '%.*s'", (int) wm->body->len, wm->body->str); 666 667 if (!strcmp(uri, "/ng") && wm->method == M_POST && wm->content_type == CT_NG) >>> CID 1583599: Code maintainability issues (UNUSED_VALUE) >>> Assigning value from "websocket_http_ng" to "handler" here, but that stored value is overwritten before it can be used. 668 handler = websocket_http_ng; 669 if (!strcmp(uri, "/ng-plain") && wm->method == M_POST 670 && (wm->content_type == CT_NG || wm->content_type == CT_JSON)) 671 handler = websocket_http_ng_plain; 672 else if (!strcmp(uri, "/admin") && wm->method == M_POST && wm->content_type == CT_JSON) 673 handler = websocket_janus_process; Change-Id: I08df9fade9cbe3bf8e0f54c9efcc98fd25353c5e --- daemon/websocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/websocket.c b/daemon/websocket.c index 92b910c5f..973051818 100644 --- a/daemon/websocket.c +++ b/daemon/websocket.c @@ -666,7 +666,7 @@ static int websocket_http_body(struct websocket_conn *wc, const char *body, size if (!strcmp(uri, "/ng") && wm->method == M_POST && wm->content_type == CT_NG) handler = websocket_http_ng; - if (!strcmp(uri, "/ng-plain") && wm->method == M_POST + else if (!strcmp(uri, "/ng-plain") && wm->method == M_POST && (wm->content_type == CT_NG || wm->content_type == CT_JSON)) handler = websocket_http_ng_plain; else if (!strcmp(uri, "/admin") && wm->method == M_POST && wm->content_type == CT_JSON)