summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2013-03-15 16:29:19 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2013-03-15 16:29:19 -0500
commite4968e7fda915d3c8d408b45c51d8f3614f213c5 (patch)
tree0b4770ff6e2d561f3c11a39bcf2118c9ad9d2862 /src
parented881174ca207a712a7b3cb5d1e756253bacb974 (diff)
downloadbluez-e4968e7fda915d3c8d408b45c51d8f3614f213c5.tar.gz
textfile: Fix a pointer arithmetic logic bug in read_key()
A substraction of pointers ends up in a wrong computation of the size passed to strnpbrk() in read_key(). This patch fixes the pointer logic.
Diffstat (limited to 'src')
-rw-r--r--src/textfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/textfile.c b/src/textfile.c
index a4e54a4cd..7267f3a77 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -335,7 +335,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;