Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,12 @@ static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_bu
}
}

number = strtod((const char*)number_c_string, (char**)&after_end);
/* Use a char* temporary for strtod's end pointer. Passing
* (char**)&after_end would violate strict aliasing rules (UB),
* because after_end is an unsigned char*. */
char *strtod_end = NULL;
number = strtod((const char*)number_c_string, &strtod_end);
after_end = (unsigned char*)strtod_end;
if (number_c_string == after_end)
{
/* free the temporary buffer */
Expand Down