aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/sqlite3_stdio.c
diff options
context:
space:
mode:
authordrh <>2025-01-17 10:39:04 +0000
committerdrh <>2025-01-17 10:39:04 +0000
commitd0c6c6586e03ddef4713388ce95e212b1c26f5ed (patch)
treed5629dab1433be19ae6aca7688c2a0954b759dd3 /ext/misc/sqlite3_stdio.c
parent1425bae1ab960c4763a34ffd09589bd715a86a1f (diff)
downloadsqlite-d0c6c6586e03ddef4713388ce95e212b1c26f5ed.tar.gz
sqlite-d0c6c6586e03ddef4713388ce95e212b1c26f5ed.zip
Fix a potential one-byte buffer overrun when reading from the Windows
console in the CLI. [forum:/forumpost/95e17b8f5c|Forum post 95e17b8f5c]. FossilOrigin-Name: 4d96759694c91301410f53a3f737a049c33e8b259b0954ff659714aff8b21ae8
Diffstat (limited to 'ext/misc/sqlite3_stdio.c')
-rw-r--r--ext/misc/sqlite3_stdio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/misc/sqlite3_stdio.c b/ext/misc/sqlite3_stdio.c
index 97c3551da..be3acc665 100644
--- a/ext/misc/sqlite3_stdio.c
+++ b/ext/misc/sqlite3_stdio.c
@@ -151,7 +151,7 @@ char *sqlite3_fgets(char *buf, int sz, FILE *in){
#ifndef SQLITE_USE_STDIO_FOR_CONSOLE
DWORD nRead = 0;
if( IsConsole(in)
- && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz, &nRead, 0)
+ && ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz-1, &nRead, 0)
){
b1[nRead] = 0;
}else