Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib/str-sanitize.h @ 7002:f359a0a9407f HEAD
str_sanitize*(): Don't crash if max_len is less than 3.
str_sanitize(): If there's nothing to sanitize, don't bother allocating
memory, just return the input string. Also allow NULL as input.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 21 Dec 2007 16:40:00 +0200 |
parents | e4eb71ae8e96 |
children |
line wrap: on
line diff
--- a/src/lib/str-sanitize.h Fri Dec 21 16:23:56 2007 +0200 +++ b/src/lib/str-sanitize.h Fri Dec 21 16:40:00 2007 +0200 @@ -4,6 +4,8 @@ /* All control characters in src will be appended as '?'. If src is longer than max_len, it's truncated with "..." appended to the end. */ void str_sanitize_append(string_t *dest, const char *src, size_t max_len); +/* Return src sanitized. If there are no changes, src pointer is returned. + If src is NULL, returns NULL. */ const char *str_sanitize(const char *src, size_t max_len); #endif