From f223e8fd1c89d0e47e2acafe14d7f3a4e8a05742 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= <ammartinez@suse.de> Date: Sat, 23 Jun 2018 00:01:17 +0200 Subject: [PATCH] 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) --- apps/x509.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/x509.c b/apps/x509.c index 1136642552..d40960c0b9 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -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"); -- 2.25.1