bwindels / wwwee

wwwee, the wee webserver: a small, robust, low-resource and fast web application server for low workloads (home server, personal cloud)
GNU General Public License v3.0
26 stars 1 forks source link

dont cast c enum with transmute to rust enum! #32

Closed bwindels closed 6 years ago

bwindels commented 6 years ago

Partial fix for #7 (Also sent BR_ERR_UNSUPPORTED_VERSION before).

Firefix was sending BadCertificate alert messages through TLS, with a self-signed certificate. We were just transmuting the bearssl error to our rust enum, but the BR_ERR_RECV_FATAL_ALERT, BR_ERR_SEND_FATAL_ALERT errors are actually OR'ed in with the Alert. Given that this can panic, don't transmute c "enums" to rust enums, but do a match with an "Other(...)" option for unrecognized values.