summaryrefslogtreecommitdiff
path: root/json.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-06-14 19:01:18 -0700
committerGary E. Miller <gem@rellim.com>2018-06-14 19:01:18 -0700
commit317375877576b10fd5312a7b0dec4a192881eead (patch)
tree8c0dffd99fa55d5e60e8bcb6a568dd08119c0365 /json.c
parent8c746a1a1d72031df001031377112841c1bc199c (diff)
downloadgpsd-317375877576b10fd5312a7b0dec4a192881eead.tar.gz
json.c be sure a string is NUL terminated.
Diffstat (limited to 'json.c')
-rw-r--r--json.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/json.c b/json.c
index 0f912c4a..6f444c18 100644
--- a/json.c
+++ b/json.c
@@ -394,6 +394,7 @@ static int json_internal_read_object(const char *cp,
case 'u':
for (n = 0; n < 4 && cp[n] != '\0'; n++)
uescape[n] = *cp++;
+ uescape[n] = '\0'; /* terminate */
--cp;
(void)sscanf(uescape, "%04x", &u);
*pval++ = (char)u; /* will truncate values above 0xff */