From: William Lallemand Date: Wed, 16 Sep 2020 09:55:09 +0000 (+0200) Subject: BUG/MINOR: ssl/crt-list: crt-list could end without a \n X-Git-Tag: v2.3-dev5~91 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=0354b658f061d00d5ab4b728d7deeff2c8f1503a;p=haproxy-2.3.git BUG/MINOR: ssl/crt-list: crt-list could end without a \n Since the refactoring of the crt-list, the same function is used to parse a crt-list file and a crt-list line on the CLI. The assumption that a line on the CLI and a line in a file is finished by a \n was made. However that is potentialy not the case with a file which does not finish by a \n. This patch fixes issue #860 and must be backported in 2.2. --- diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index 2ef3a37..b813787 100644 --- a/src/ssl_crtlist.c +++ b/src/ssl_crtlist.c @@ -380,8 +380,8 @@ int crtlist_parse_file(char *file, struct bind_conf *bind_conf, struct proxy *cu cfgerr |= ERR_ALERT | ERR_FATAL; goto error; } - - *(end - 1) = '\0'; /* line parser mustn't receive any \n */ + if (*(end - 1) == '\n') + *(end - 1) = '\0'; /* line parser mustn't receive any \n */ cfgerr |= crtlist_parse_line(thisline, &crt_path, entry, file, linenum, err); if (cfgerr) goto error;