From c4d3b1e606afc70b059d5b8b5918b91d5bcb61fd Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 12 Sep 2017 09:49:38 +0200 Subject: [PATCH] hidpp20: fix Invalid writes Valgrind complains... Fixes 19451f9df775e Signed-off-by: Benjamin Tissoires --- src/hidpp20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hidpp20.c b/src/hidpp20.c index 57fca364..8ee21315 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -339,7 +339,7 @@ hidpp20_feature_set_get(struct hidpp20_device *device) if (!feature_count) return -ENOTSUP; - flist = zalloc(feature_count * sizeof(struct hidpp20_feature)); + flist = zalloc((feature_count + 1) * sizeof(struct hidpp20_feature)); /* feature set count does not include the root feature as documented here: * https://6xq.net/git/lars/lshidpp.git/plain/doc/logitech_hidpp_2.0_specification_draft_2012-06-04.pdf