diff --git a/src/rjp_parse.c b/src/rjp_parse.c index 5776617..940c249 100644 --- a/src/rjp_parse.c +++ b/src/rjp_parse.c @@ -340,8 +340,8 @@ char* rjp_parse_error_to_string(RJP_parse_error* err){ break; case RJP_PARSE_STATUS_NO_ROOT_VALUE: format = "Missing root JSON value"; - buffer = rjp_alloc(snprintf(NULL, 0, format) + 1); - sprintf(buffer, format); + buffer = rjp_alloc(snprintf(NULL, 0, "%s", format) + 1); + sprintf(buffer, "%s", format); break; case RJP_PARSE_STATUS_MISSING_KEY: format = "Expected key before '%.*s'"; @@ -355,13 +355,13 @@ char* rjp_parse_error_to_string(RJP_parse_error* err){ break; case RJP_PARSE_STATUS_EXCESS_DATA: format = "Excess data after JSON"; - buffer = rjp_alloc(snprintf(NULL, 0, format) + 1); - sprintf(buffer, format); + buffer = rjp_alloc(snprintf(NULL, 0, "%s", format) + 1); + sprintf(buffer, "%s", format); break; case RJP_PARSE_STATUS_MISSING_CLOSE_BRACE: format = "Missing closing brace"; - buffer = rjp_alloc(snprintf(NULL, 0, format) + 1); - sprintf(buffer, format); + buffer = rjp_alloc(snprintf(NULL, 0, "%s", format) + 1); + sprintf(buffer, "%s", format); break; default: break;