aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/json1.c
diff options
context:
space:
mode:
authordrh <>2021-04-30 16:12:40 +0000
committerdrh <>2021-04-30 16:12:40 +0000
commit76baad95f4793ac2b9793e8f820c8c371f3b8fa0 (patch)
tree660995e4bdb6ae19c6398cc10dda31da2287d516 /ext/misc/json1.c
parent0449f6561f4d8ac50eb09d581958f47f73a17b6e (diff)
downloadsqlite-76baad95f4793ac2b9793e8f820c8c371f3b8fa0.tar.gz
sqlite-76baad95f4793ac2b9793e8f820c8c371f3b8fa0.zip
Guard against a NULL-pointer dereference following OOM in the JSON extension.
FossilOrigin-Name: ea221f3c8e243a5dc4952e510cbe396614a24876bacdc04fb1ebd4127c7ef0d9
Diffstat (limited to 'ext/misc/json1.c')
-rw-r--r--ext/misc/json1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/misc/json1.c b/ext/misc/json1.c
index 76c6e40f8..41ff01db4 100644
--- a/ext/misc/json1.c
+++ b/ext/misc/json1.c
@@ -299,7 +299,7 @@ static void jsonAppendSeparator(JsonString *p){
*/
static void jsonAppendString(JsonString *p, const char *zIn, u32 N){
u32 i;
- if( (N+p->nUsed+2 >= p->nAlloc) && jsonGrow(p,N+2)!=0 ) return;
+ if( zIn==0 || ((N+p->nUsed+2 >= p->nAlloc) && jsonGrow(p,N+2)!=0) ) return;
p->zBuf[p->nUsed++] = '"';
for(i=0; i<N; i++){
unsigned char c = ((unsigned const char*)zIn)[i];