diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-25 14:03:42 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-25 14:03:42 +0300 |
commit | b9a9496cc4cd6619fc1a7c6a59d39e7147a9f20e (patch) | |
tree | 43b692bdccc08ae8672ae0b576fbf1e1baaa6a79 /src/fstring.c | |
parent | 1cd34f5283bcf1d4973a351dc5235094608e3d2d (diff) | |
download | rspamd-b9a9496cc4cd6619fc1a7c6a59d39e7147a9f20e.tar.gz rspamd-b9a9496cc4cd6619fc1a7c6a59d39e7147a9f20e.zip |
* Fix memory corruption and lmtp handling
* Add e-mail address validation in lmtp
Diffstat (limited to 'src/fstring.c')
-rw-r--r-- | src/fstring.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/fstring.c b/src/fstring.c index 82d0b095e..3098e8726 100644 --- a/src/fstring.c +++ b/src/fstring.c @@ -190,14 +190,16 @@ fstrcpy (f_str_t *dest, f_str_t *src) size_t fstrcat (f_str_t *dest, f_str_t *src) { - register size_t cur = src->len; + register size_t cur = 0; + char *p = dest->begin + dest->len; if (dest->size < src->len + dest->len) { return 0; } - while (cur < src->len && cur < dest->size) { - *(dest->begin + cur) = *(src->begin + cur); + while (cur < src->len) { + *p = *(src->begin + cur); + p ++; cur ++; } @@ -246,14 +248,7 @@ fstralloc (memory_pool_t *pool, size_t len) { f_str_t *res = memory_pool_alloc (pool, sizeof (f_str_t)); - if (res == NULL) { - return NULL; - } res->begin = memory_pool_alloc (pool, len); - if (res->begin == NULL) { - free (res); - return NULL; - } res->size = len; res->len = 0; |