
snagarajan206118 (Community Member) asked a question.
In my c++ application, I want to return a char buffer from a method. I received CWE 416 vulnerability.
ConfigCoreStrings* WrapperGetCoreConfigString()
{
char* buffer;
unsigned int buffer_size = (1024 * 128);
buffer = (char*)malloc(buffer_size);
if (buffer == NULL)
{
free(wGetCoreConfigString);
}
memset(buffer, 0, buffer_size); //Line where the vulnerablity indicates
}
I tried putting memset(buffer, 0, buffer_size); inside else case, but didn't help. Any suggestions??
.png)
Hi @snagarajan206118 (Community Member),
It seems like perhaps there is some missing context here, such as the arguments to the function.
I recommend scheduling a consultation to discuss this with one of our Application Security Consultants.
Kind regards,
Duncan
@snagarajan206118 (Community Member) do you have any solution for this item?