summary refs log tree commit diff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2019-01-28 16:24:01 +0100
committerDuncaen <mail@duncano.de>2019-02-08 19:55:47 +0100
commitcfba3e1c3b79eb9bb67e8e4959b39e4d9723da60 (patch)
treee3cca2dcdb9452fdea088efd7278eee6d75056e6
parent820c07b7e410200f7d0b93069103250719a38636 (diff)
downloadmblaze-cfba3e1c3b79eb9bb67e8e4959b39e4d9723da60.tar.gz
mblaze-cfba3e1c3b79eb9bb67e8e4959b39e4d9723da60.tar.xz
mblaze-cfba3e1c3b79eb9bb67e8e4959b39e4d9723da60.zip
mpick: fix off-by-one in parse_string (expression parsing) v0.5
-rw-r--r--NEWS.md1
-rw-r--r--mpick.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/NEWS.md b/NEWS.md
index b5f1fbb..97c172f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -14,6 +14,7 @@
 * mscan: new flag -v for statistics
 * magrep: add -h, which is like -p but doesn't print the file name
 * mscan: prioritize displaying trashed mail over other markers
+* mpick: fix off-by-one in expression parsing
 * Many bug fixes
 
 ## 0.4 (2018-08-15)
diff --git a/mpick.c b/mpick.c
index b412f8e..1704044 100644
--- a/mpick.c
+++ b/mpick.c
@@ -284,7 +284,7 @@ parse_string(char **s)
 		pos++;
 		while (*pos &&
 		    (*pos != '"' || (*pos == '"' && *(pos+1) == '"'))) {
-			if (len >= bufsiz) {
+			if (len+1 >= bufsiz) {
 				bufsiz = 2*bufsiz + 16;
 				buf = realloc(buf, bufsiz);
 				if (!buf)