mosquitto
mosquitto copied to clipboard
Integer underflow in websockets.c
The properties uid and gid of the struct lws_context_creation_info are defined as type uid_t and gid_t, which both resolve to unsigned int, respectively.
websockets.c: In function ‘mosq_websockets_init’:
websockets.c:702:20: warning: unsigned conversion from ‘int’ to ‘gid_t’ {aka ‘unsigned int’} changes value from ‘-1’ to ‘4294967295’ [-Wsign-conversion]
702 | info.gid = -1;
| ^
websockets.c:703:20: warning: unsigned conversion from ‘int’ to ‘uid_t’ {aka ‘unsigned int’} changes value from ‘-1’ to ‘4294967295’ [-Wsign-conversion]
703 | info.uid = -1;
|
The current behavior in websockets.c is most likely undesired, I guess. What would be appropriate values here?
The libwebsockets documentation explicitly says to set them to -1 if not used, so there's no real option to do otherwise.