X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/3634fc257bd0667daef14d72005cd87c735bbb24..25bd12fdff615275da6b811570b0f65d57ddc441:/src/src/auths/xtextencode.c diff --git a/src/src/auths/xtextencode.c b/src/src/auths/xtextencode.c index 7cdfe3224..30ff8f11d 100644 --- a/src/src/auths/xtextencode.c +++ b/src/src/auths/xtextencode.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2009 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ #include "../exim.h" @@ -28,7 +28,7 @@ uschar * auth_xtextencode(uschar *clear, int len) { uschar *code; -uschar *p = (uschar *)clear; +uschar *p = US clear; uschar *pp; int c = len; int count = 1; @@ -40,19 +40,15 @@ in order to get the right amount of store. */ while (c -- > 0) count += ((x = *p++) < 33 || x > 127 || x == '+' || x == '=')? 3 : 1; -pp = code = store_get(count); +pp = code = store_get(count, is_tainted(clear)); -p = (uschar *)clear; +p = US clear; c = len; while (c-- > 0) - { if ((x = *p++) < 33 || x > 127 || x == '+' || x == '=') - { - sprintf(CS pp, "+%.02x", x); /* There's always room */ - pp += 3; - } - else *pp++ = x; - } + pp += sprintf(CS pp, "+%.02x", x); /* There's always room */ + else + *pp++ = x; *pp = 0; return code;