mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-12 18:23:04 +01:00
gpg: Make sure we only have a single SQL statement.
* g10/tofu.c (sqlite3_stepx): Make sure SQL only contains a single SQL statement. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
parent
5b0ed7674d
commit
c18fb0d99b
17
g10/tofu.c
17
g10/tofu.c
@ -289,10 +289,25 @@ sqlite3_stepx (sqlite3 *db,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = sqlite3_prepare_v2 (db, sql, -1, &stmt, NULL);
|
const char *tail = NULL;
|
||||||
|
|
||||||
|
rc = sqlite3_prepare_v2 (db, sql, -1, &stmt, &tail);
|
||||||
if (rc)
|
if (rc)
|
||||||
log_fatal ("failed to prepare SQL: %s", sql);
|
log_fatal ("failed to prepare SQL: %s", sql);
|
||||||
|
|
||||||
|
/* We can only process a single statement. */
|
||||||
|
if (tail)
|
||||||
|
{
|
||||||
|
while (*tail == ' ' || *tail == ';')
|
||||||
|
tail ++;
|
||||||
|
|
||||||
|
if (*tail)
|
||||||
|
log_fatal
|
||||||
|
("sqlite3_stepx can only process a single SQL statement."
|
||||||
|
" Second statement starts with: '%s'\n",
|
||||||
|
tail);
|
||||||
|
}
|
||||||
|
|
||||||
if (stmtp)
|
if (stmtp)
|
||||||
*stmtp = stmt;
|
*stmtp = stmt;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user