openssl: fix bytes-terminator problem on Racket CS

Make sure the argument to SSL_ctrl has a nul terminator.
This commit is contained in:
Matthew Flatt 2019-06-26 10:35:39 -06:00
parent 5e59ae0586
commit 8985a409b8

View File

@ -308,7 +308,8 @@ TO DO:
(define-ssl SSL_renegotiate (_fun _SSL* -> _int)) (define-ssl SSL_renegotiate (_fun _SSL* -> _int))
(define-ssl SSL_renegotiate_pending (_fun _SSL* -> _int)) (define-ssl SSL_renegotiate_pending (_fun _SSL* -> _int))
(define-ssl SSL_do_handshake (_fun _SSL* -> _int)) (define-ssl SSL_do_handshake (_fun _SSL* -> _int))
(define-ssl SSL_ctrl (_fun _SSL* _int _long _pointer -> _long)) (define-ssl SSL_ctrl/bytes (_fun _SSL* _int _long _bytes/nul-terminated -> _long)
#:c-id SSL_ctrl)
(define-ssl SSL_set_SSL_CTX (_fun _SSL* _SSL_CTX* -> _SSL_CTX*)) (define-ssl SSL_set_SSL_CTX (_fun _SSL* _SSL_CTX* -> _SSL_CTX*))
(define-crypto X509_free (_fun _X509* -> _void) (define-crypto X509_free (_fun _X509* -> _void)
@ -1456,8 +1457,8 @@ TO DO:
(ssl-context-verify-hostname? context-or-encrypt-method)] (ssl-context-verify-hostname? context-or-encrypt-method)]
[else #f])]) [else #f])])
(when (string? hostname) (when (string? hostname)
(SSL_ctrl ssl SSL_CTRL_SET_TLSEXT_HOSTNAME (SSL_ctrl/bytes ssl SSL_CTRL_SET_TLSEXT_HOSTNAME
TLSEXT_NAMETYPE_host_name (string->bytes/latin-1 hostname))) TLSEXT_NAMETYPE_host_name (string->bytes/latin-1 hostname)))
;; connect/accept: ;; connect/accept:
(let-values ([(buffer) (make-bytes BUFFER-SIZE)] (let-values ([(buffer) (make-bytes BUFFER-SIZE)]