Skip to content

Commit

Permalink
Replaced strlen in process_string with pointer arithmetic.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabis committed Apr 25, 2015
1 parent 4a4cf7d commit 2b4d17b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parson.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ static char* process_string(const char *input, size_t len) {
input_ptr++;
}
*output_ptr = '\0';
if (try_realloc((void**)&output, strlen(output) + 1) == JSONFailure)
if (try_realloc((void**)&output, (size_t)(output_ptr-output) + 1) == JSONFailure) /* resize to new length */
goto error;
return output;
error:
Expand Down

0 comments on commit 2b4d17b

Please sign in to comment.