#include <limits.h>
#include "internal/cryptlib.h"
#include <openssl/asn1.h>
+#include "asn1_locl.h"
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max);
else
len = strlen(data);
}
- if ((str->length < len) || (str->data == NULL)) {
+ if ((str->length <= len) || (str->data == NULL)) {
c = str->data;
str->data = OPENSSL_realloc(c, len + 1);
if (str->data == NULL) {
return (ret);
}
-void ASN1_STRING_free(ASN1_STRING *a)
+void asn1_string_embed_free(ASN1_STRING *a, int embed)
{
if (a == NULL)
return;
if (!(a->flags & ASN1_STRING_FLAG_NDEF))
OPENSSL_free(a->data);
- if (!(a->flags & ASN1_STRING_FLAG_EMBED))
+ if (embed == 0)
OPENSSL_free(a);
}
+void ASN1_STRING_free(ASN1_STRING *a)
+{
+ if (a == NULL)
+ return;
+ asn1_string_embed_free(a, a->flags & ASN1_STRING_FLAG_EMBED);
+}
+
void ASN1_STRING_clear_free(ASN1_STRING *a)
{
if (a == NULL)
return x->type;
}
+const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x)
+{
+ return x->data;
+}
+
+# if OPENSSL_API_COMPAT < 0x10100000L
unsigned char *ASN1_STRING_data(ASN1_STRING *x)
{
return x->data;
}
+#endif