diff options
| author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-16 21:11:36 +0800 | 
|---|---|---|
| committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-16 21:11:36 +0800 | 
| commit | b018ae643dbba21c0060ccb0748a7b239b4ecb5a (patch) | |
| tree | 0c00ca1cb59c72e6054aca8e1f231df8d4a0e0e4 | |
| parent | abe673f9ae7d9d23e92a188ade187ec020b1f67a (diff) | |
Initialise items JSON before concatenating
| -rw-r--r-- | anteraja.c | 4 | 
1 files changed, 3 insertions, 1 deletions
@@ -108,8 +108,10 @@ void anteraja_order(const char *trx_id, const char *service, const char *sender_  				atoi(items[i][PRICE]), atoi(items[i][WEIGHT]) * 1000);  		if (json)  			json = realloc(json, strlen(json) + length); -		else +		else {  			json = malloc(length); +			memset(json, '\0', strlen(json)); +		}  		strcat(json, item);  		if (i + 1 < nitems)  			json[length] = ',';  |