You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
943 B

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