Check query strings of query-style lookups for quoting. Bug 2850
[exim.git] / src / src / lookups / nisplus.c
index dc3735b6bac7fe40846458011ed33d05bef015f0..0892fc4c3dcca017c43a186d40971686ce71cbc1 100644 (file)
@@ -226,25 +226,24 @@ characters. No options are recognized.
 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 *
-nisplus_quote(uschar *s, uschar *opt)
+nisplus_quote(uschar * s, uschar * opt, unsigned idx)
 {
 int count = 0;
-uschar *quoted;
-uschar *t = s;
+uschar * quoted, * t = s;
 
-if (opt != NULL) return NULL;    /* No options recognized */
+if (opt) return NULL;    /* No options recognized */
 
-while (*t != 0) if (*t++ == '\"') count++;
-if (count == 0) return s;
+while (*t) if (*t++ == '\"') count++;
 
-t = quoted = store_get(Ustrlen(s) + count + 1, is_tainted(s));
+t = quoted = store_get_quoted(Ustrlen(s) + count + 1, s, idx);
 
-while (*s != 0)
+while (*s)
   {
   *t++ = *s;
   if (*s++ == '\"') *t++ = '\"';