diff options
author | Michael Brown | 2014-03-25 17:09:16 +0100 |
---|---|---|
committer | Michael Brown | 2014-03-25 17:30:43 +0100 |
commit | e1ebc50f81eb1ad24218a5e69d42565a9d8cc035 (patch) | |
tree | 4ccc865359dd1f65e7382e663a80e90d7b0db3b6 /src/crypto/ocsp.c | |
parent | [crypto] Remove dynamically-allocated storage for certificate name (diff) | |
download | ipxe-e1ebc50f81eb1ad24218a5e69d42565a9d8cc035.tar.gz ipxe-e1ebc50f81eb1ad24218a5e69d42565a9d8cc035.tar.xz ipxe-e1ebc50f81eb1ad24218a5e69d42565a9d8cc035.zip |
[crypto] Remove dynamically-allocated storage for certificate OCSP URI
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto/ocsp.c')
-rw-r--r-- | src/crypto/ocsp.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/crypto/ocsp.c b/src/crypto/ocsp.c index 1b39fd0d..75d9a092 100644 --- a/src/crypto/ocsp.c +++ b/src/crypto/ocsp.c @@ -206,17 +206,17 @@ static int ocsp_request ( struct ocsp_check *ocsp ) { * @ret rc Return status code */ static int ocsp_uri_string ( struct ocsp_check *ocsp ) { + struct x509_ocsp_responder *responder = + &ocsp->cert->extensions.auth_info.ocsp; struct uri path_uri; - char *base_uri_string; char *path_base64_string; char *path_uri_string; size_t path_len; - int len; + size_t len; int rc; /* Sanity check */ - base_uri_string = ocsp->cert->extensions.auth_info.ocsp.uri; - if ( ! base_uri_string ) { + if ( ! responder->uri.len ) { DBGC ( ocsp, "OCSP %p \"%s\" has no OCSP URI\n", ocsp, x509_name ( ocsp->cert ) ); rc = -ENOTTY; @@ -244,11 +244,14 @@ static int ocsp_uri_string ( struct ocsp_check *ocsp ) { } /* Construct URI string */ - if ( ( len = asprintf ( &ocsp->uri_string, "%s/%s", base_uri_string, - path_uri_string ) ) < 0 ) { - rc = len; + len = ( responder->uri.len + strlen ( path_uri_string ) + 1 /* NUL */ ); + ocsp->uri_string = zalloc ( len ); + if ( ! ocsp->uri_string ) { + rc = -ENOMEM; goto err_ocsp_uri; } + memcpy ( ocsp->uri_string, responder->uri.data, responder->uri.len ); + strcpy ( &ocsp->uri_string[responder->uri.len], path_uri_string ); DBGC2 ( ocsp, "OCSP %p \"%s\" URI is %s\n", ocsp, x509_name ( ocsp->cert ), ocsp->uri_string ); |