… | |
… | |
351 | if (ws_version) |
351 | if (ws_version) |
352 | { |
352 | { |
353 | if (ws_inbuf_len + 2048 > ws_inbuf_alloc) |
353 | if (ws_inbuf_len + 2048 > ws_inbuf_alloc) |
354 | ws_inbuf = (uint8 *)realloc (ws_inbuf, ws_inbuf_alloc += 4096); |
354 | ws_inbuf = (uint8 *)realloc (ws_inbuf, ws_inbuf_alloc += 4096); |
355 | |
355 | |
356 | rbuf = ws_inbuf; |
356 | rbuf = ws_inbuf + ws_inbuf_len; |
357 | amount = ws_inbuf_alloc - ws_inbuf_len; |
357 | amount = ws_inbuf_alloc - ws_inbuf_len; |
358 | } |
358 | } |
359 | else |
359 | else |
360 | { |
360 | { |
361 | rbuf = inbuf; |
361 | rbuf = inbuf + inbuf_len; |
362 | amount = sizeof (inbuf) - inbuf_len; |
362 | amount = sizeof (inbuf) - inbuf_len; |
363 | } |
363 | } |
364 | |
364 | |
365 | if (!amount) |
365 | if (!amount) |
366 | { |
366 | { |
… | |
… | |
368 | LOG (llevError, "input buffer overflow."); |
368 | LOG (llevError, "input buffer overflow."); |
369 | destroy (); |
369 | destroy (); |
370 | return; |
370 | return; |
371 | } |
371 | } |
372 | |
372 | |
373 | amount = read (fd, ws_inbuf + ws_inbuf_len, amount); |
373 | amount = read (fd, rbuf, amount); |
374 | |
374 | |
375 | if (!amount) |
375 | if (!amount) |
376 | { |
376 | { |
377 | destroy (); |
377 | destroy (); |
378 | return; |
378 | return; |