X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fload.c;h=7acd3e7a74599642722325562d42d986927130f7;hb=ff0c05b8f13f4f8a1da82ef1337d594916ef9df9;hp=245244ee16101632644f107d10a1039492ba22d1;hpb=4601bf71e532c7a0be2f468521e54e86666c6c63;p=jansson.git diff --git a/src/load.c b/src/load.c index 245244e..7acd3e7 100644 --- a/src/load.c +++ b/src/load.c @@ -13,7 +13,7 @@ #include #include -#include +#include "jansson.h" #include "jansson_private.h" #include "strbuffer.h" #include "utf.h" @@ -87,6 +87,7 @@ static void error_set(json_error_t *error, const lex_t *lex, va_start(ap, msg); vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap); + msg_text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; va_end(ap); if(lex) @@ -102,6 +103,7 @@ static void error_set(json_error_t *error, const lex_t *lex, if(lex->saved_text.length <= 20) { snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, "%s near '%s'", msg_text, saved_text); + msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; result = msg_with_context; } } @@ -114,6 +116,7 @@ static void error_set(json_error_t *error, const lex_t *lex, else { snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, "%s near end of file", msg_text); + msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; result = msg_with_context; } } @@ -444,7 +447,11 @@ out: } #if JSON_INTEGER_IS_LONG_LONG +#ifdef _WIN32 +#define json_strtoint _strtoi64 +#else #define json_strtoint strtoll +#endif #else #define json_strtoint strtol #endif