projects
/
platform
/
upstream
/
libwebsockets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1f8ec7c
)
test server http dont print junk if string too long
author
Andy Green
<andy.green@linaro.org>
Tue, 19 Jan 2016 14:20:18 +0000
(22:20 +0800)
committer
Andy Green
<andy.green@linaro.org>
Tue, 19 Jan 2016 14:20:18 +0000
(22:20 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
test-server/test-server-http.c
patch
|
blob
|
history
diff --git
a/test-server/test-server-http.c
b/test-server/test-server-http.c
index
aa9502f
..
4c93496
100644
(file)
--- a/
test-server/test-server-http.c
+++ b/
test-server/test-server-http.c
@@
-62,7
+62,7
@@
struct serveable {
void
dump_handshake_info(struct lws *wsi)
{
- int n = 0;
+ int n = 0
, len
;
char buf[256];
const unsigned char *c;
@@
-73,12
+73,14
@@
dump_handshake_info(struct lws *wsi)
continue;
}
- if (!lws_hdr_total_length(wsi, n)) {
+ len = lws_hdr_total_length(wsi, n);
+ if (!len || len > sizeof(buf) - 1) {
n++;
continue;
}
lws_hdr_copy(wsi, buf, sizeof buf, n);
+ buf[sizeof(buf) - 1] = '\0';
fprintf(stderr, " %s = %s\n", (char *)c, buf);
n++;