]> source.dussan.org Git - rspamd.git/commitdiff
* Fix stupid bug in calculating buffer length while reading file maps
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 1 Jul 2010 12:40:28 +0000 (16:40 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 1 Jul 2010 12:40:28 +0000 (16:40 +0400)
src/map.c

index d6e57715a46ca6999d27be036b6b9120a00cd789..b864c6a42bd80d876d8a1b01e31c7459b8643bf6 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -386,8 +386,9 @@ read_map_file (struct rspamd_map *map, struct file_map_data *data)
 
        rlen = 0;
        while ((r = read (fd, buf + rlen, sizeof (buf) - rlen - 1)) > 0) {
-               buf[r++] = '\0';
-               remain = map->read_callback (map->pool, buf, r - 1, &cbdata);
+               r += rlen;
+               buf[r] = '\0';
+               remain = map->read_callback (map->pool, buf, r, &cbdata);
                if (remain != NULL) {
                        /* copy remaining buffer to start of buffer */
                        rlen = r - (remain - buf);