summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-11-08 19:57:23 +0100
committerGravatar Nikias Bassen2013-11-08 19:57:23 +0100
commit24a37ba75cc95fdd4382ada67197163a84b9cb8f (patch)
treea68b62f047976f27a3d66994b35cd70c61a25ee9
parent132a9f1d7003a54c20abc81fa5f6833f09ffa13b (diff)
downloadlibimobiledevice-24a37ba75cc95fdd4382ada67197163a84b9cb8f.tar.gz
libimobiledevice-24a37ba75cc95fdd4382ada67197163a84b9cb8f.tar.bz2
lockdown: fix possible invalid free in GnuTLS cert generation code
-rw-r--r--src/lockdown.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 690ab56..ed91e9d 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -1420,6 +1420,9 @@ lockdownd_error_t lockdownd_gen_pair_cert_for_udid(const char *udid, key_data_t
1420 gnutls_x509_crt_t dev_cert, root_cert, host_cert; 1420 gnutls_x509_crt_t dev_cert, root_cert, host_cert;
1421 1421
1422 gnutls_x509_privkey_init(&fake_privkey); 1422 gnutls_x509_privkey_init(&fake_privkey);
1423 gnutls_x509_privkey_init(&root_privkey);
1424 gnutls_x509_privkey_init(&host_privkey);
1425
1423 gnutls_x509_crt_init(&dev_cert); 1426 gnutls_x509_crt_init(&dev_cert);
1424 gnutls_x509_crt_init(&root_cert); 1427 gnutls_x509_crt_init(&root_cert);
1425 gnutls_x509_crt_init(&host_cert); 1428 gnutls_x509_crt_init(&host_cert);
@@ -1428,9 +1431,6 @@ lockdownd_error_t lockdownd_gen_pair_cert_for_udid(const char *udid, key_data_t
1428 gnutls_x509_privkey_import_rsa_raw(fake_privkey, &modulus, &exponent, &essentially_null, &essentially_null, 1431 gnutls_x509_privkey_import_rsa_raw(fake_privkey, &modulus, &exponent, &essentially_null, &essentially_null,
1429 &essentially_null, &essentially_null)) { 1432 &essentially_null, &essentially_null)) {
1430 1433
1431 gnutls_x509_privkey_init(&root_privkey);
1432 gnutls_x509_privkey_init(&host_privkey);
1433
1434 uret = userpref_device_record_get_keys_and_certs(udid, root_privkey, root_cert, host_privkey, host_cert); 1434 uret = userpref_device_record_get_keys_and_certs(udid, root_privkey, root_cert, host_privkey, host_cert);
1435 1435
1436 if (USERPREF_E_SUCCESS == uret) { 1436 if (USERPREF_E_SUCCESS == uret) {