bind protocol: fix for NULL names
authorSilas Parker <skyhisi@user.github.invalid.com>
Fri, 7 Apr 2017 10:22:54 +0000 (18:22 +0800)
committerAndy Green <andy@warmcat.com>
Fri, 7 Apr 2017 10:22:54 +0000 (18:22 +0800)
lib/libwebsockets.c

index e4a42dc..6917070 100755 (executable)
@@ -200,7 +200,7 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p)
                vpo = vp;
 
                while (n--) {
-                       if (!strcmp(p->name, vp->name)) {
+                       if (p->name && vp->name && !strcmp(p->name, vp->name)) {
                                hit = 1;
                                lws_same_vh_protocol_insert(wsi, vp - vpo);
                                break;