mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Fix segfault in libwebsocket_write()
Since 'shift' has unsigned integer type, the following code may lead to infinite cycle and segfault: while (shift >= 0) { if (shift) buf[0 - pre + n] = ((len >> shift) & 127) | 0x80; else buf[0 - pre + n] = ((len >> shift) & 127); n++; shift -= 7; } Change type to signed integer. Signed-off-by: Pavel Borzenkov <pavel.borzenkov@auriga.com>
This commit is contained in:
parent
876534b0d5
commit
4b65a562a5
1 changed files with 1 additions and 1 deletions
|
@ -1115,7 +1115,7 @@ int libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf,
|
|||
int m;
|
||||
int pre = 0;
|
||||
int post = 0;
|
||||
unsigned int shift = 7;
|
||||
int shift = 7;
|
||||
struct lws_tokens eff_buf;
|
||||
int ret;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue