commit 9808d38797600567a2260db488d0f8a826369763
parent e7b8e27615c3301cabadeed4b999f56bed11d85d
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 18 Aug 2018 09:53:52 -0700
osx: fix off by one error causing a crash
Probably the reason the linux one was crashing randomly as well
Fixes #2
Reported-by: @renepickhardt
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/json.c b/json.c
@@ -335,7 +335,7 @@ int parse_clightning_channels(FILE *fd, int *nchans, struct channel **pchannels)
 		tokstr = &buffer[tok->start];
 
 		// allocate more channels if needed
-		if (*nchans > chancap) {
+		if (*nchans >= chancap) {
 			chancap *= 2;
 			res = realloc(channels, chancap * sizeof(struct channel));
 			if (res == NULL) {