openbsd-ports/audio/umurmur/patches/patch-src_ssl_c
dcoppa 835663b224 Bunch of fixes from upstream:
Fix unsafe client removal from list at timeout.
(upstream git commit ad3bc56f96b024ac31e8927f21d1f5e7b8f61b56)

Reset timeout timer when receiving UDP data too: fix timeout when
using push-to-talk. Correct speling error.
(upstream git commit 6087b18a630eb32df682a7fd90d88408aa99c726)

Fix handling of long cipherstrings/lists with OpenSSL.
(upstream git commit 35d4608d0e044df48ee8cea13d3cbeafbb33535d)
2012-10-12 13:31:49 +00:00

47 lines
1.6 KiB
Plaintext

$OpenBSD: patch-src_ssl_c,v 1.1 2012/10/12 13:31:49 dcoppa Exp $
Fix handling of long cipherstrings/lists with OpenSSL.
(upstream git commit 35d4608d0e044df48ee8cea13d3cbeafbb33535d)
--- src/ssl.c.orig Fri Oct 12 15:17:40 2012
+++ src/ssl.c Fri Oct 12 15:18:27 2012
@@ -508,10 +508,10 @@ void SSLi_init(void)
{
const SSL_METHOD *method;
SSL *ssl;
- int i, offset = 0;
+ int i, offset = 0, cipherstringlen = 0;
STACK_OF(SSL_CIPHER) *cipherlist = NULL, *cipherlist_new = NULL;
SSL_CIPHER *cipher;
- char cipherstring[1024];
+ char *cipherstring, tempstring[128];
SSL_library_init();
OpenSSL_add_all_algorithms(); /* load & register all cryptos, etc. */
@@ -546,9 +546,14 @@ void SSLi_init(void)
if (cipherlist_new) {
for ( i = 0; (cipher = sk_SSL_CIPHER_value(cipherlist_new, i)) != NULL; i++) {
Log_debug("%s", SSL_CIPHER_get_name(cipher));
- offset += snprintf(cipherstring + offset, 1024 - offset, "%s:", SSL_CIPHER_get_name(cipher));
+ cipherstringlen += strlen(SSL_CIPHER_get_name(cipher)) + 1;
}
- cipherstring[offset - 1] = '\0';
+ cipherstring = malloc(cipherstringlen + 1);
+ if (cipherstring == NULL)
+ Log_fatal("Out of memory");
+ for (i = 0; (cipher = sk_SSL_CIPHER_value(cipherlist_new, i)) != NULL; i++) {
+ offset += sprintf(cipherstring + offset, "%s:", SSL_CIPHER_get_name(cipher));
+ }
}
if (cipherlist_new)
@@ -559,6 +564,8 @@ void SSLi_init(void)
if (SSL_CTX_set_cipher_list(context, cipherstring) == 0)
Log_fatal("Failed to set cipher list!");
+
+ free(cipherstring);
SSL_CTX_set_verify(context, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
verify_callback);