-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Labels
Description
Hello. When compiling with hardened flags:
src/handshake.c: In function ‘strstricase’:
src/handshake.c:90:32: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
90 | return (char*)haystack;
To resolve, simply remove the const keyword for haystack.
Another warning lies at toyws.c where tws_receiveframe returns a uint64_t while it is said to return an int.
extra/toyws/toyws.c: In function ‘tws_receiveframe’:
extra/toyws/toyws.c:400:59: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘uint64_t’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Wsign-compare]
400 | return (ret == 0 ? frame_length : ret);
| ^~~
extra/toyws/toyws.c:409:43: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘uint64_t’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Wsign-compare]
409 | return (ret == 0 ? frame_length : ret);
| ^~~
For this I dunno how to resolve without breaking. Given that the frame size spans the full unsigned 64-bit range, including zero, we can not allocate a magic value for error.