File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -364,12 +364,14 @@ impl PySslContext {
364
364
}
365
365
366
366
#[ pymethod]
367
- fn set_ciphers ( & self , cipherlist : CString , vm : & VirtualMachine ) -> PyResult < ( ) > {
368
- self . builder ( )
369
- . set_cipher_list ( cipherlist. to_str ( ) . unwrap ( ) )
370
- . map_err ( |_| {
371
- vm. new_exception_msg ( ssl_error ( vm) , "No cipher can be selected." . to_owned ( ) )
372
- } )
367
+ fn set_ciphers ( & self , cipherlist : PyStringRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
368
+ let ciphers = cipherlist. as_str ( ) ;
369
+ if ciphers. contains ( '\0' ) {
370
+ return Err ( vm. new_value_error ( "embedded null character" . to_owned ( ) ) ) ;
371
+ }
372
+ self . builder ( ) . set_cipher_list ( ciphers) . map_err ( |_| {
373
+ vm. new_exception_msg ( ssl_error ( vm) , "No cipher can be selected." . to_owned ( ) )
374
+ } )
373
375
}
374
376
375
377
#[ pyproperty]
You can’t perform that action at this time.
0 commit comments