X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/0756eb3cb50d73a77b486e47528f7cb1bffdb299..a5bdc7ee1e3d69ff9e32987a58ebae94043db9e2:/src/src/lookups/lf_quote.c diff --git a/src/src/lookups/lf_quote.c b/src/src/lookups/lf_quote.c index 9cc291723..2a76756e9 100644 --- a/src/src/lookups/lf_quote.c +++ b/src/src/lookups/lf_quote.c @@ -1,10 +1,8 @@ -/* $Cambridge: exim/src/src/lookups/lf_quote.c,v 1.1 2004/10/07 13:10:01 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2004 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -39,7 +37,11 @@ result = string_append(result, asize, aoffset, 2, name, US"="); /* NULL is handled as an empty string */ -if (value == NULL) value = US""; +if (!value) + { + value = US""; + vlength = 0; + } /* Quote the value if it is empty, contains white space, or starts with a quote character. */ @@ -47,21 +49,19 @@ character. */ if (value[0] == 0 || Ustrpbrk(value, " \t\n\r") != NULL || value[0] == '\"') { int j; - result = string_cat(result, asize, aoffset, US"\"", 1); + result = string_catn(result, asize, aoffset, US"\"", 1); for (j = 0; j < vlength; j++) { if (value[j] == '\"' || value[j] == '\\') - result = string_cat(result, asize, aoffset, US"\\", 1); - result = string_cat(result, asize, aoffset, US value+j, 1); + result = string_catn(result, asize, aoffset, US"\\", 1); + result = string_catn(result, asize, aoffset, US value+j, 1); } - result = string_cat(result, asize, aoffset, US"\"", 1); + result = string_catn(result, asize, aoffset, US"\"", 1); } else - { - result = string_cat(result, asize, aoffset, US value, vlength); - } + result = string_catn(result, asize, aoffset, US value, vlength); -return string_cat(result, asize, aoffset, US" ", 1); +return string_catn(result, asize, aoffset, US" ", 1); } /* End of lf_quote.c */