mirror of
https://git.yoctoproject.org/poky
synced 2026-07-16 15:57:04 +00:00
sqlite3: fix CVE-2021-36690
refer: https://nvd.nist.gov/vuln/detail/CVE-2021-36690 https://www.sqlite.org/forum/forumpost/718c0a8d17 https://sqlite.org/src/info/b1e0c22ec981cf5f (From OE-Core rev: b0c311d784e939342c4bfa771790a0113fc7a704) Signed-off-by: Changqing Li <changqing.li@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
7de4e6b582
commit
a5e9dd4bc6
@@ -0,0 +1,62 @@
|
||||
From c286324a7ff1e98355b638fb821614a65ee03c0c Mon Sep 17 00:00:00 2001
|
||||
From: Changqing Li <changqing.li@windriver.com>
|
||||
Date: Tue, 14 Sep 2021 11:28:54 +0800
|
||||
Subject: [PATCH] Fix an issue with the SQLite Expert extension when a column
|
||||
has no collating sequence. Forum post 78165fa250.
|
||||
|
||||
Upstream-Status: Backport [https://sqlite.org/src/info/b1e0c22ec981cf5f]
|
||||
CVE: CVE-2021-36690
|
||||
|
||||
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
||||
---
|
||||
shell.c | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/shell.c b/shell.c
|
||||
index de8a665..69a5c05 100644
|
||||
--- a/shell.c
|
||||
+++ b/shell.c
|
||||
@@ -9054,11 +9054,13 @@ static int idxGetTableInfo(
|
||||
rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
|
||||
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
|
||||
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
|
||||
+ const char *zColSeq = 0;
|
||||
nByte += 1 + STRLEN(zCol);
|
||||
rc = sqlite3_table_column_metadata(
|
||||
- db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
|
||||
+ db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0
|
||||
);
|
||||
- nByte += 1 + STRLEN(zCol);
|
||||
+ if( zColSeq==0 ) zColSeq = "binary";
|
||||
+ nByte += 1 + STRLEN(zColSeq);
|
||||
nCol++;
|
||||
nPk += (sqlite3_column_int(p1, 5)>0);
|
||||
}
|
||||
@@ -9078,6 +9080,7 @@ static int idxGetTableInfo(
|
||||
nCol = 0;
|
||||
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
|
||||
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
|
||||
+ const char *zColSeq = 0;
|
||||
int nCopy = STRLEN(zCol) + 1;
|
||||
pNew->aCol[nCol].zName = pCsr;
|
||||
pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1);
|
||||
@@ -9085,12 +9088,13 @@ static int idxGetTableInfo(
|
||||
pCsr += nCopy;
|
||||
|
||||
rc = sqlite3_table_column_metadata(
|
||||
- db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
|
||||
+ db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0
|
||||
);
|
||||
if( rc==SQLITE_OK ){
|
||||
- nCopy = STRLEN(zCol) + 1;
|
||||
+ if( zColSeq==0 ) zColSeq = "binary";
|
||||
+ nCopy = STRLEN(zColSeq) + 1;
|
||||
pNew->aCol[nCol].zColl = pCsr;
|
||||
- memcpy(pCsr, zCol, nCopy);
|
||||
+ memcpy(pCsr, zColSeq, nCopy);
|
||||
pCsr += nCopy;
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Reference in New Issue
Block a user