Browse Source

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
pull/1802/head
Donat Zenichev 2 years ago
parent
commit
5a7a757431
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      daemon/websocket.c

+ 1
- 1
daemon/websocket.c View File

@ -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)


Loading…
Cancel
Save