소스 검색

Possible fix for SSL implementations where CRYPTO_num_locks returns 0 (see #436)

bel2125 8 년 전
부모
커밋
d2ebc9d35d
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/civetweb.c

+ 4 - 1
src/civetweb.c

@@ -12663,7 +12663,10 @@ initialize_ssl(char *ebuf, size_t ebuf_len)
 		i = 0;
 	}
 	size = sizeof(pthread_mutex_t) * ((size_t)(i));
-	if ((ssl_mutexes = (pthread_mutex_t *)mg_malloc(size)) == NULL) {
+
+	if (size == 0) {
+		ssl_mutexes = NULL;
+	} else if ((ssl_mutexes = (pthread_mutex_t *)mg_malloc(size)) == NULL) {
 		mg_snprintf(NULL,
 		            NULL, /* No truncation check for ebuf */
 		            ebuf,