1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

coverity 192910: check length in h2 header dump

Since the NUL was always taken care of at the end of buf, the worst it could
do was log some junk.  This makes it explicitly log it as oversize separately.
This commit is contained in:
Andy Green 2018-11-13 16:53:41 +08:00
parent f6ae0edf8d
commit 66b73c680c

View file

@ -1382,10 +1382,13 @@ lws_h2_parse_end_of_frame(struct lws *wsi)
continue;
}
lws_hdr_copy(h2n->swsi, buf, sizeof buf, n);
buf[sizeof(buf) - 1] = '\0';
if (lws_hdr_copy(h2n->swsi, buf, sizeof buf, n) < 0) {
lwsl_info(" %s !oversize!\n", (char *)c);
} else {
buf[sizeof(buf) - 1] = '\0';
lwsl_info(" %s = %s\n", (char *)c, buf);
lwsl_info(" %s = %s\n", (char *)c, buf);
}
n++;
} while (c);
}