Karlson2k / libmicrohttpd

GNU libmicrohttpd repository unofficial mirror on GitHub
https://www.gnu.org/software/libmicrohttpd/
Other
97 stars 29 forks source link

Use uint32_t instead of ulong for websocket mask #13

Closed gre-42 closed 3 years ago

gre-42 commented 3 years ago

The websocket mask is defined as char mask_[4] but casted to unsigned long, which has 64 bits on modern Linux systems.

Karlson2k commented 3 years ago

Hi. Is uint32 size fixed somewhere?

gre-42 commented 3 years ago

It is defined here: https://en.cppreference.com/w/c/types/integer

Karlson2k commented 3 years ago

The question was about your suggested change. Is any websockets variable/structure field defined as 32 bit size? You didn't provide any motivation or explanation for the suggested change, that's why I need to clarify this.

gre-42 commented 3 years ago

The MHD_WebSocketStream mask_key is defined as 32 bit size.

struct MHD_WebSocketStream
{
...
  /* The mask key of the current frame (control or data); this is 0 if no masking used */
  char mask_key[4];
};
Karlson2k commented 3 years ago

I see. Makes sense. Thank you.

Karlson2k commented 3 years ago

Please set correct author name and email for commits next time.

This PR is merged as 441dbcfe52171c550b696eb45d1d87cb07653823.