Mercurial > dovecot > original-hg > dovecot-1.2
comparison 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 |
comparison
equal
deleted
inserted
replaced
7001:7305d675b05c | 7002:f359a0a9407f |
---|---|
2 #define STR_SANITIZE_H | 2 #define STR_SANITIZE_H |
3 | 3 |
4 /* All control characters in src will be appended as '?'. If src is longer | 4 /* All control characters in src will be appended as '?'. If src is longer |
5 than max_len, it's truncated with "..." appended to the end. */ | 5 than max_len, it's truncated with "..." appended to the end. */ |
6 void str_sanitize_append(string_t *dest, const char *src, size_t max_len); | 6 void str_sanitize_append(string_t *dest, const char *src, size_t max_len); |
7 /* Return src sanitized. If there are no changes, src pointer is returned. | |
8 If src is NULL, returns NULL. */ | |
7 const char *str_sanitize(const char *src, size_t max_len); | 9 const char *str_sanitize(const char *src, size_t max_len); |
8 | 10 |
9 #endif | 11 #endif |