Project

General

Profile

Actions

Bug #2858

closed

Wrong websocket frametype if frame is longer then UINT16_MAX

Added by rschmid almost 7 years ago. Updated over 6 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_wstunnel
Target version:
ASK QUESTIONS IN Forums:

Description

Hello,

I tried mod_wstunnel in lighttpd 1.4.48. If the framesize is bigger then UINT16_MAX in RFC 6455 the frametype in websocket header buffer (mem) on pos 0 is been overwriten by

memset(mem, 0, sizeof(mem)); 
(mod_wstunnel.c line 1125).

Actions #1

Updated by stbuehler almost 7 years ago

That line also doesn't seem to be needed for something else given the other 9 bytes are all explicitly set.

Actions #2

Updated by rschmid almost 7 years ago

stbuehler wrote:

That line also doesn't seem to be needed for something else given the other 9 bytes are all explicitly set.

you are right

This diff worked for me

--- a/src/mod_wstunnel.c    2018-01-19 12:17:14.774391315 +0100
+++ b/src/mod_wstunnel.c    2018-01-19 12:18:32.061732967 +0100
@@ -1122,7 +1122,6 @@ static int send_rfc_6455(handler_ctx *hc
         len = 1+MOD_WEBSOCKET_FRAME_LEN16_CNT+1;
     }
     else {
-        memset(mem, 0, sizeof(mem));
         mem[1] = MOD_WEBSOCKET_FRAME_LEN63;
         mem[2] = 0;
         mem[3] = 0;
Actions #3

Updated by gstrauss almost 7 years ago

  • Category set to mod_wstunnel
  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.49

Yes, that's a bug. Sorry. Will push a fix to lighttpd git master soon.

Actions #4

Updated by gstrauss almost 7 years ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100
Actions #5

Updated by pidloop over 6 years ago

Thanks for finding and fixing this one, it was critical to my application. I had been using 1.4.48 and was getting "Received unexpected continuation frame" whenever my backend process would send a large message. 1.4.49 fixed it and now it works great. I'll now go make a donation!

BTW, I am using Centos 7 which still only has 1.4.48 in its default repository. Not sure who manages that but it would be great if this could be updated to 1.4.49 to save me the trouble of building lighttpd 1.4.19 from source on my other systems.

Thanks again!

Actions #6

Updated by avij over 6 years ago

You are likely using lighttpd from EPEL. CentOS itself does not have lighttpd. Try "yum update --enablerepo=epel-testing". If it works, please give positive karma on https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-2a3d51dc83 to make the package move from testing to stable quicker.

Actions

Also available in: Atom