mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
coverity 169270: client: handle NULL protocol
This commit is contained in:
parent
0e8b3fed12
commit
3775ac9d2e
1 changed files with 5 additions and 2 deletions
|
@ -876,7 +876,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
|
|||
|
||||
n = 0;
|
||||
while (wsi->vhost->protocols[n].callback) {
|
||||
if (strcmp(wsi->protocol->name,
|
||||
if (wsi->protocol && strcmp(wsi->protocol->name,
|
||||
wsi->vhost->protocols[n].name) == 0) {
|
||||
wsi->protocol = &wsi->vhost->protocols[n];
|
||||
break;
|
||||
|
@ -885,7 +885,10 @@ lws_client_interpret_server_handshake(struct lws *wsi)
|
|||
}
|
||||
|
||||
if (!wsi->vhost->protocols[n].callback) {
|
||||
lwsl_err("Failed to match protocol %s\n", wsi->protocol->name);
|
||||
if (wsi->protocol)
|
||||
lwsl_err("Failed to match protocol %s\n", wsi->protocol->name);
|
||||
else
|
||||
lwsl_err("No protocol on client\n");
|
||||
goto bail2;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue