packages/net/haproxy/patches/0010-BUG-MINOR-ssl-Check-malloc-return-code.patch
heil 079d911cfb haproxy: bump to version 1.6.9 mainline and pending patches
Signed-off-by: heil <heil@terminal-consulting.de>
2016-11-09 23:42:43 +01:00

29 lines
943 B
Diff

From 2d7ed4ae91383cd35fe07cd34d01c23b4a5d03f5 Mon Sep 17 00:00:00 2001
From: "Thierry FOURNIER / OZON.IO" <thierry.fournier@ozon.io>
Date: Thu, 6 Oct 2016 10:35:29 +0200
Subject: [PATCH 10/26] BUG/MINOR: ssl: Check malloc return code
If malloc() can't allocate memory and return NULL, a segfaut will raises.
This patch should be backported in the 1.6 and 1.5 version.
(cherry picked from commit 7a3bd3b9dc43509bb1869389dcf91e35c0155f9b)
---
src/ssl_sock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 0535a3b..5f9a203 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -1572,6 +1572,8 @@ static int ssl_sock_add_cert_sni(SSL_CTX *ctx, struct bind_conf *s, char *name,
int j, len;
len = strlen(name);
sc = malloc(sizeof(struct sni_ctx) + len + 1);
+ if (!sc)
+ return order;
for (j = 0; j < len; j++)
sc->name.key[j] = tolower(name[j]);
sc->name.key[len] = 0;
--
2.7.3