Merge "stasis: Remove stringfields and lock from change message."
[asterisk/asterisk.git] / third-party / jansson / patches / 0022-Avoid-invalid-memory-read-in-json_pack.patch
1 From aed855e6920923898b94a1b922fbace27a34ddf2 Mon Sep 17 00:00:00 2001
2 From: Petri Lehtinen <petri@digip.org>
3 Date: Mon, 9 Jul 2018 22:26:35 +0300
4 Subject: [PATCH 22/29] Avoid invalid memory read in json_pack()
5
6 Initial patch by @bharjoc-bitdefender
7
8 Fixes #421
9 ---
10  src/pack_unpack.c | 5 ++++-
11  1 file changed, 4 insertions(+), 1 deletion(-)
12
13 diff --git a/src/pack_unpack.c b/src/pack_unpack.c
14 index 6461c06..b842772 100644
15 --- a/src/pack_unpack.c
16 +++ b/src/pack_unpack.c
17 @@ -75,6 +75,9 @@ static void next_token(scanner_t *s)
18          return;
19      }
20  
21 +    if (!token(s) && !*s->fmt)
22 +        return;
23 +
24      t = s->fmt;
25      s->column++;
26      s->pos++;
27 @@ -97,7 +100,7 @@ static void next_token(scanner_t *s)
28      s->token.column = s->column;
29      s->token.pos = s->pos;
30  
31 -    t++;
32 +    if (*t) t++;
33      s->fmt = t;
34  }
35  
36 -- 
37 2.17.1
38