diff --git a/src/textfile.c b/src/textfile.c | |
index 2712cd8..74c58fb 100644 | |
--- a/src/textfile.c | |
+++ b/src/textfile.c | |
@@ -338,7 +338,7 @@ static char *read_key(const char *pathname, const char *key, int icase) | |
goto unmap; | |
} | |
- end = strnpbrk(off, size - (map - off), "\r\n"); | |
+ end = strnpbrk(off, size - (off - map), "\r\n"); | |
if (!end) { | |
err = -EILSEQ; | |
goto unmap; |