From cd03a40c15d4c5839247912c4f535069fb831aa7 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Wed, 27 Jan 2021 14:58:51 +0100 Subject: [PATCH] BUG/MINOR: ssl: init tmp chunk correctly in ssl_sock_load_sctl_from_file() Use chunk_inistr() for a chunk initialisation in ssl_sock_load_sctl_from_file() instead of a manual initialisation which was not initialising head. Fix issue #1073. Must be backported as far as 2.2 (cherry picked from commit 8d67394f6915c6d2db40bc1e9593fd392827da8d) Signed-off-by: Willy Tarreau (cherry picked from commit 7cdbb5643de32c97f9d7693f140b89f4a4cb9493) Signed-off-by: Christopher Faulet (cherry picked from commit 5df6c0815064a48111d6a35b9ce29677e087a0b0) [cf: Backport to 2.1 also required; context adjustment] Signed-off-by: Christopher Faulet --- src/ssl_sock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 43b65be..f3b5094 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -1442,9 +1442,7 @@ static int ssl_sock_load_sctl_from_file(const char *sctl_path, char *buf, struct struct buffer *sctl; if (buf) { - tmp.area = buf; - tmp.data = strlen(buf); - tmp.size = tmp.data + 1; + chunk_initstr(&tmp, buf); src = &tmp; } else { fd = open(sctl_path, O_RDONLY); -- 1.7.10.4