summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/sqlite/files/CVE-2023-36191.patch
blob: aca79c334aa2f764aebf0cd197033d7b8348a7c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 4e8a0eb4e773b808d9e9697af94319599777169a Mon Sep 17 00:00:00 2001
From: larrybr <larrybr@noemail.net>
Date: Fri, 2 Jun 2023 12:56:32 +0000
Subject: [PATCH] Fix CLI fault on missing -nonce reported by [forum:/info/f8c14a1134|forum post f8c14a1134].

FossilOrigin-Name: cd24178bbaad4a1dafc3848e7d74240f90030160b5c43c93e1e0e11b073c2df5

Upstream-Status: Backport [https://sqlite.org/src/info/cd24178bbaad4a1d
Upstream commit https://github.com/sqlite/sqlite/commit/4e8a0eb4e773b808d9e9697af94319599777169a]
CVE: CVE-2023-36191
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
 shell.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/shell.c b/shell.c
index 0200c0a..fa45d40 100644
--- a/shell.c
+++ b/shell.c
@@ -23163,8 +23163,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
     }else if( strcmp(z,"-bail")==0 ){
       bail_on_error = 1;
     }else if( strcmp(z,"-nonce")==0 ){
-      free(data.zNonce);
-      data.zNonce = strdup(argv[++i]);
+      if( data.zNonce ) free(data.zNonce);
+      if( i+1 < argc ) data.zNonce = strdup(argv[++i]);
+      else{
+        data.zNonce = 0;
+        break;
+      }
     }else if( strcmp(z,"-safe")==0 ){
       /* no-op - catch this on the second pass */
     }
-- 
2.25.1