From 332695078487a91376d8dd5ab9f8121118ab63b7 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 28 May 2018 11:22:48 +0300 Subject: [PATCH] input: Fix compiler error with GCC 8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following error: profiles/input/device.c: In function ‘hidp_add_connection’: profiles/input/device.c:677:47: error: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 0 and 127 [-Werror=format-truncation=] snprintf(req->name, sizeof(req->name), "%s %s", ^~ pname, sdesc); ~~~~~ profiles/input/device.c:677:4: note: ‘snprintf’ output between 2 and 256 bytes into a destination of size 128 snprintf(req->name, sizeof(req->name), "%s %s", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pname, sdesc); --- profiles/input/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/input/device.c b/profiles/input/device.c index d867cca04..84614784d 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -667,10 +667,10 @@ static void epox_endian_quirk(unsigned char *data, int size) static int create_hid_dev_name(sdp_record_t *rec, struct hidp_connadd_req *req) { - char sdesc[sizeof(req->name)]; + char sdesc[sizeof(req->name) / 2]; if (sdp_get_service_desc(rec, sdesc, sizeof(sdesc)) == 0) { - char pname[sizeof(req->name)]; + char pname[sizeof(req->name) / 2]; if (sdp_get_provider_name(rec, pname, sizeof(pname)) == 0 && strncmp(sdesc, pname, 5) != 0) -- 2.47.3