lib: json: Fix number parsing

Comparing *endptr with '\0' will always be true before replacing
*token->end with prev_end.

Jira: ZEP-1607
Change-Id: I224129586e15380d3919bfba3db4fcf38c28cb07
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
diff --git a/lib/json/json.c b/lib/json/json.c
index 283ab06..fd97bc2 100644
--- a/lib/json/json.c
+++ b/lib/json/json.c
@@ -389,8 +389,7 @@
 static int decode_num(const struct token *token, int32_t *num)
 {
 	/* FIXME: strtod() is not available in newlib/minimal libc,
-	 * so using strtol() here; this means no floating point
-	 * numbers.
+	 * so using strtol() here.
 	 */
 	char *endptr;
 	char prev_end;
@@ -407,7 +406,7 @@
 		return -errno;
 	}
 
-	if (*endptr) {
+	if (endptr != token->end) {
 		return -EINVAL;
 	}