my C prog return buffer overflow , i want concatenate one string and one input string this my code
#include "ring.h"
#include "string.h"
#include "stdlib.h"
RING_FUNC(ring_bingetaccount)
{
char Address[100] = {0};
// Check Parameters Count
if (RING_API_PARACOUNT != 1) {
RING_API_ERROR(RING_API_MISS1PARA);
return;
}
// Check Parameters Type
if ( ! RING_API_ISSTRING(1) ) {
RING_API_ERROR(RING_API_BADPARATYPE);
return;
}
char destination[] = "curl -X GET https://dex.binance.org/api/v1/account/";
strcpy(Address,RING_API_GETSTRING(1));
strcat(destination,Address);
int status = system(destination);
}
if i remove strcat(destination,Address); not return buffer overflow but ofcourse not do what i want , thanks at all
destinationhas enough space for exactly just"curl -X GET https://dex.binance.org/api/v1/account/"yet you try tostrcat()more characters in there. Trychar destination[4200] = "whatever";for a larger space in the array (that is still unused (but filled with'\0's) as of the initialization).