Latest update.
This commit is contained in:
+14
-10
@@ -15,7 +15,7 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/err.h>
|
||||
#include "internal/numbers.h"
|
||||
#include "asn1_locl.h"
|
||||
#include "asn1_local.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -108,7 +108,8 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
|
||||
{
|
||||
ASN1_TLC c;
|
||||
ASN1_VALUE *ptmpval = NULL;
|
||||
if (!pval)
|
||||
|
||||
if (pval == NULL)
|
||||
pval = &ptmpval;
|
||||
asn1_tlc_clear_nc(&c);
|
||||
if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
|
||||
@@ -149,7 +150,8 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
int otag;
|
||||
int ret = 0;
|
||||
ASN1_VALUE **pchptr;
|
||||
if (!pval)
|
||||
|
||||
if (pval == NULL)
|
||||
return 0;
|
||||
if (aux && aux->asn1_cb)
|
||||
asn1_cb = aux->asn1_cb;
|
||||
@@ -303,7 +305,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!*pval && !ASN1_item_ex_new(pval, it)) {
|
||||
if (*pval == NULL && !ASN1_item_ex_new(pval, it)) {
|
||||
ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
@@ -554,7 +556,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
return 0;
|
||||
} else if (ret == -1)
|
||||
return -1;
|
||||
if (!*val)
|
||||
if (*val == NULL)
|
||||
*val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();
|
||||
else {
|
||||
/*
|
||||
@@ -568,7 +570,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
|
||||
}
|
||||
}
|
||||
|
||||
if (!*val) {
|
||||
if (*val == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
@@ -649,7 +651,8 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
|
||||
BUF_MEM buf = { 0, NULL, 0, 0 };
|
||||
const unsigned char *cont = NULL;
|
||||
long len;
|
||||
if (!pval) {
|
||||
|
||||
if (pval == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
|
||||
return 0; /* Should never happen */
|
||||
}
|
||||
@@ -786,7 +789,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
|
||||
/* If ANY type clear type and set pointer to internal value */
|
||||
if (it->utype == V_ASN1_ANY) {
|
||||
if (!*pval) {
|
||||
if (*pval == NULL) {
|
||||
typ = ASN1_TYPE_new();
|
||||
if (typ == NULL)
|
||||
goto err;
|
||||
@@ -866,7 +869,7 @@ static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
|
||||
goto err;
|
||||
}
|
||||
/* All based on ASN1_STRING and handled the same */
|
||||
if (!*pval) {
|
||||
if (*pval == NULL) {
|
||||
stmp = ASN1_STRING_type_new(utype);
|
||||
if (stmp == NULL) {
|
||||
ASN1err(ASN1_F_ASN1_EX_C2I, ERR_R_MALLOC_FAILURE);
|
||||
@@ -1058,10 +1061,11 @@ static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen)
|
||||
static int asn1_check_eoc(const unsigned char **in, long len)
|
||||
{
|
||||
const unsigned char *p;
|
||||
|
||||
if (len < 2)
|
||||
return 0;
|
||||
p = *in;
|
||||
if (!p[0] && !p[1]) {
|
||||
if (p[0] == '\0' && p[1] == '\0') {
|
||||
*in += 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user