]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[crypto] Fail fast if cross-certificate source is empty
authorLadi Prosek <lprosek@redhat.com>
Wed, 20 Sep 2017 09:52:16 +0000 (11:52 +0200)
committerMichael Brown <mcb30@ipxe.org>
Sun, 24 Sep 2017 16:56:04 +0000 (17:56 +0100)
In fully self-contained deployments it may be desirable to build iPXE
with an empty CROSSCERT source to avoid talking to external services.

Add an explicit check for this case and make validator_start_download
fail immediately if the base URI is empty.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/validator.c

index 52845b6ed2c7d64c5b13d5f0909a5a8b4f0f39a5..68abe1b55640af8763d0826bec81f76e0af65781 100644 (file)
@@ -239,6 +239,10 @@ static int validator_start_download ( struct validator *validator,
        /* Determine cross-signed certificate source */
        fetch_string_setting_copy ( NULL, &crosscert_setting, &crosscert_copy );
        crosscert = ( crosscert_copy ? crosscert_copy : crosscert_default );
+       if ( ! crosscert[0] ) {
+               rc = -EINVAL;
+               goto err_check_uri_string;
+       }
 
        /* Allocate URI string */
        uri_string_len = ( strlen ( crosscert ) + 22 /* "/%08x.der?subject=" */
@@ -277,6 +281,7 @@ static int validator_start_download ( struct validator *validator,
  err_open_uri_string:
        free ( uri_string );
  err_alloc_uri_string:
+ err_check_uri_string:
        free ( crosscert_copy );
        return rc;
 }