/*
- * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
{
char *tmp;
- if (!ia5 || !ia5->length)
+ if (ia5 == NULL || ia5->length == 0)
return NULL;
if ((tmp = OPENSSL_malloc(ia5->length + 1)) == NULL) {
X509V3err(X509V3_F_I2S_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE);
X509V3_CTX *ctx, const char *str)
{
ASN1_IA5STRING *ia5;
- if (!str) {
+ if (str == NULL) {
X509V3err(X509V3_F_S2I_ASN1_IA5STRING,
X509V3_R_INVALID_NULL_ARGUMENT);
return NULL;
X509V3err(X509V3_F_I2S_ASN1_UTF8STRING, ERR_R_PASSED_NULL_PARAMETER);
return NULL;
}
- if ((tmp = OPENSSL_zalloc(utf8->length + 1)) == NULL) {
+ if ((tmp = OPENSSL_malloc(utf8->length + 1)) == NULL) {
X509V3err(X509V3_F_I2S_ASN1_UTF8STRING, ERR_R_MALLOC_FAILURE);
return NULL;
}
memcpy(tmp, utf8->data, utf8->length);
+ tmp[utf8->length] = 0;
return tmp;
}