git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SPDX: Mass-update to GPL-2.0-or-later
[exim.git]
/
src
/
src
/
lookups
/
sqlite.c
diff --git
a/src/src/lookups/sqlite.c
b/src/src/lookups/sqlite.c
index 65e7cffc9e89e5dcb2a51ce7e7b3228d60fe12c0..6c7af4225eac0bd71c0209dc438ee2140166fd5c 100644
(file)
--- a/
src/src/lookups/sqlite.c
+++ b/
src/src/lookups/sqlite.c
@@
-2,9
+2,10
@@
* Exim - an Internet mail transport agent *
*************************************************/
* Exim - an Internet mail transport agent *
*************************************************/
+/* Copyright (c) The Exim Maintainers 2020 - 2022 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
/* See the file NOTICE for conditions of use and distribution. */
/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "../exim.h"
#include "lf_functions.h"
#include "../exim.h"
#include "lf_functions.h"
@@
-126,26
+127,25
@@
for sqlite is the single quote, and it is quoted by doubling.
Arguments:
s the string to be quoted
opt additional option text or NULL if none
Arguments:
s the string to be quoted
opt additional option text or NULL if none
+ idx lookup type index
Returns: the processed string or NULL for a bad option
*/
static uschar *
Returns: the processed string or NULL for a bad option
*/
static uschar *
-sqlite_quote(uschar *
s, uschar *opt
)
+sqlite_quote(uschar *
s, uschar * opt, unsigned idx
)
{
{
-register int c;
-int count = 0;
-uschar *t = s;
-uschar *quoted;
+int c, count = 0;
+uschar * t = s, * quoted;
-if (opt
!= NULL
) return NULL; /* No options recognized */
+if (opt) return NULL; /* No options recognized */
-while ((c = *t++) != 0) if (c == '\'') count++;
+while ((c = *t++)) if (c == '\'') count++;
+count += t - s;
-if (count == 0) return s;
-t = quoted = store_get(Ustrlen(s) + count + 1, is_tainted(s));
+t = quoted = store_get_quoted(count + 1, s, idx);
-while ((c = *s++)
!= 0
)
+while ((c = *s++))
{
if (c == '\'') *t++ = '\'';
*t++ = c;
{
if (c == '\'') *t++ = '\'';
*t++ = c;