(pk_rd_pa_reply_enckey): simplify handling of content data (and avoid
leaking memory). git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21109 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -955,8 +955,6 @@ pk_rd_pa_reply_enckey(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
struct krb5_pk_cert *host = NULL;
|
struct krb5_pk_cert *host = NULL;
|
||||||
size_t size;
|
size_t size;
|
||||||
int length;
|
|
||||||
void *p;
|
|
||||||
krb5_data content;
|
krb5_data content;
|
||||||
heim_oid contentType = { 0, NULL };
|
heim_oid contentType = { 0, NULL };
|
||||||
|
|
||||||
@@ -983,9 +981,7 @@ pk_rd_pa_reply_enckey(krb5_context context,
|
|||||||
"Failed to unenvelope CMS data in PK-INIT reply");
|
"Failed to unenvelope CMS data in PK-INIT reply");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
der_free_oid(&contentType);
|
||||||
p = content.data;
|
|
||||||
length = content.length;
|
|
||||||
|
|
||||||
#if 0 /* windows LH with interesting CMS packets, leaks memory */
|
#if 0 /* windows LH with interesting CMS packets, leaks memory */
|
||||||
{
|
{
|
||||||
@@ -1009,7 +1005,7 @@ pk_rd_pa_reply_enckey(krb5_context context,
|
|||||||
if (type == COMPAT_WIN2K) {
|
if (type == COMPAT_WIN2K) {
|
||||||
ContentInfo ci;
|
ContentInfo ci;
|
||||||
|
|
||||||
ret = decode_ContentInfo(p, length, &ci, &size);
|
ret = decode_ContentInfo(content.data, content.length, &ci, &size);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_set_error_string(context,
|
krb5_set_error_string(context,
|
||||||
"PKINIT: failed decoding ContentInfo: %d",
|
"PKINIT: failed decoding ContentInfo: %d",
|
||||||
@@ -1028,14 +1024,17 @@ pk_rd_pa_reply_enckey(krb5_context context,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
krb5_data_free(&content);
|
krb5_data_free(&content);
|
||||||
content = *ci.content;
|
ret = krb5_data_copy(&content, ci.content->data, ci.content->length);
|
||||||
p = ci.content->data;
|
free_ContentInfo(&ci);
|
||||||
length = ci.content->length;
|
if (ret) {
|
||||||
|
krb5_set_error_string(context, "PKINIT: out of memory");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = _krb5_pk_verify_sign(context,
|
ret = _krb5_pk_verify_sign(context,
|
||||||
p,
|
content.data,
|
||||||
length,
|
content.length,
|
||||||
ctx->id,
|
ctx->id,
|
||||||
&contentType,
|
&contentType,
|
||||||
&content,
|
&content,
|
||||||
|
Reference in New Issue
Block a user