aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/map.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/map.c b/src/map.c
index d6e57715a..b864c6a42 100644
--- 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);