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:
2790d5b
)
lws_write: report and reject suspicious lengths
author
Andy Green
<andy@warmcat.com>
Mon, 8 May 2017 02:49:10 +0000
(10:49 +0800)
committer
Andy Green
<andy@warmcat.com>
Tue, 9 May 2017 06:18:40 +0000
(14:18 +0800)
lib/output.c
patch
|
blob
|
history
diff --git
a/lib/output.c
b/lib/output.c
index c77b5c050435380c09f721e529d9557657478557..a41b0e0dfc68f5fd77ce843c9dafbca5bab7a5c2 100644
(file)
--- a/
lib/output.c
+++ b/
lib/output.c
@@
-244,6
+244,12
@@
LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len,
int pre = 0, n;
size_t orig_len = len;
+ if ((int)len < 0) {
+ lwsl_err("%s: suspicious len int %d, ulong %lu\n", __func__,
+ (int)len, (unsigned long)len);
+ return -1;
+ }
+
#ifdef LWS_WITH_ACCESS_LOG
wsi->access_log.sent += len;
#endif