Support directories with "." in x509_load_serial()

Use `strrchr` to get a pointer to the last occurrence of `.` in the
path string, instead of the first one with `strchr`.  This prevent the
path to be wrongly split if it contains several `.`, and not only the
one for the extension.

Fixes https://github.com/openssl/openssl/issues/6489.

CLA: trivial

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6566)
This commit is contained in:
Ana María Martínez Gómez 2018-06-23 00:01:17 +02:00 committed by Dr. Matthias St. Pierre
parent eaf39a9fe6
commit f223e8fd1c
1 changed files with 1 additions and 1 deletions

View File

@ -916,7 +916,7 @@ static ASN1_INTEGER *x509_load_serial(const char *CAfile,
BIGNUM *serial = NULL;
if (serialfile == NULL) {
const char *p = strchr(CAfile, '.');
const char *p = strrchr(CAfile, '.');
size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile);
buf = app_malloc(len + sizeof(POSTFIX), "serial# buffer");