very obvious use after free. this file may still be a total loss.
return KSSL_CTX_ERR;
break;
}
- if (*princ)
- free(*princ);
+ free(*princ);
+ *princ = NULL;
/* Add up all the entity->lengths */
length = 0;
return KSSL_CTX_ERR;
break;
}
- if (*string)
- free(*string);
+ free(*string);
+ *string = NULL;
- if (!text) {
- *string = '\0';
- return KSSL_CTX_OK;
- }
-
- if ((*string = calloc(1, strlen(text) + 1)) == NULL)
+ if ((*string = strdup(text ? text : "")) == NULL)
return KSSL_CTX_ERR;
- else
- memcpy(*string, text, strlen(text) + 1);
return KSSL_CTX_OK;
}
if (kssl_ctx->key) {
OPENSSL_cleanse(kssl_ctx->key, kssl_ctx->length);
free(kssl_ctx->key);
+ kssl_ctx->key = NULL;
}
if (session) {