]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps.c: Fix crash in case uri arg of IS_HTTP or IS_HTTPS is NULL
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 10 Dec 2020 16:10:52 +0000 (17:10 +0100)
committerDr. David von Oheimb <dev@ddvo.net>
Mon, 11 Jan 2021 18:35:34 +0000 (19:35 +0100)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13712)

apps/lib/apps.c

index 1998a8bc2f59cc881893537ddac19c34a847c021..457dac87bc41257405c76f1da963f1030bcb4214 100644 (file)
@@ -469,10 +469,10 @@ CONF *app_load_config_modules(const char *configfile)
     return conf;
 }
 
-#define IS_HTTP(uri) \
-    (strncmp(uri, OSSL_HTTP_PREFIX, strlen(OSSL_HTTP_PREFIX)) == 0)
-#define IS_HTTPS(uri) \
-    (strncmp(uri, OSSL_HTTPS_PREFIX, strlen(OSSL_HTTPS_PREFIX)) == 0)
+#define IS_HTTP(uri) ((uri) != NULL \
+        && strncmp(uri, OSSL_HTTP_PREFIX, strlen(OSSL_HTTP_PREFIX)) == 0)
+#define IS_HTTPS(uri) ((uri) != NULL \
+        && strncmp(uri, OSSL_HTTPS_PREFIX, strlen(OSSL_HTTPS_PREFIX)) == 0)
 
 X509 *load_cert_pass(const char *uri, int maybe_stdin,
                      const char *pass, const char *desc)