diff options
-rw-r--r-- | src/libutil/map.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c index 0f622a209..e632fc871 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -275,11 +275,15 @@ read_map_file (struct rspamd_map *map, struct file_map_data *data) tlen += r; 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); memmove (buf, remain, rlen); } + else { + rlen = 0; + } } if (remain != NULL && remain > buf) { |