Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Resolved string truncation

  • Loading branch information...
commit aad1986cf5b3aef884d2d1e0b296cca6c8f46dc6 1 parent e8fe3bc
@montegoulding authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 mergJSON/mergJSON.c
View
5 mergJSON/mergJSON.c
@@ -72,8 +72,9 @@ char * getPrimitiveString(json_t * tJSON) {
case JSON_STRING:
{
char * tTemp = (char *)json_string_value(tJSON);
- tReturn = (char*)malloc(strlen(tTemp)+1);
- snprintf(tReturn,strlen(tTemp),"%s",tTemp);
+ int t_length = strlen(tTemp)+1;
+ tReturn = (char*)malloc(t_length);
+ snprintf(tReturn,t_length,"%s",tTemp);
}
break;
case JSON_OBJECT:
Please sign in to comment.
Something went wrong with that request. Please try again.