summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2014-02-11 23:16:53 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2014-02-11 23:16:53 -0500
commit56df93d12857fb3d13f7e14391954e3b59708261 (patch)
tree42e50bc7698f5380261a3b4cdd14e4a0fc6500e9
parentceeaf42bc80f84a4ffab6660f4a062d4efef13cd (diff)
downloadjson-c-56df93d12857fb3d13f7e14391954e3b59708261.tar.gz
Fix Issue #111: Fix off-by-one error when range checking the input to json_tokener_error_desc().
-rw-r--r--json_tokener.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/json_tokener.c b/json_tokener.c
index a2a598b..4ebe712 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -74,7 +74,7 @@ const char* json_tokener_errors[] = {
const char *json_tokener_error_desc(enum json_tokener_error jerr)
{
int jerr_int = (int)jerr;
- if (jerr_int < 0 || jerr_int > (int)(sizeof(json_tokener_errors) / sizeof(json_tokener_errors[0])))
+ if (jerr_int < 0 || jerr_int >= (int)(sizeof(json_tokener_errors) / sizeof(json_tokener_errors[0])))
return "Unknown error, invalid json_tokener_error value passed to json_tokener_error_desc()";
return json_tokener_errors[jerr];
}