From 19faa212562664db90d7cebe4a804bf9b86451ff Mon Sep 17 00:00:00 2001 From: June Tate-Gans Date: Sun, 25 Apr 2021 14:30:46 -0500 Subject: [PATCH] g13d: Fix horribly broken strncpy usage The sizeof was actually using the size of the statically allocated name instead of the size of the destination. In practice, it's not a problem, but still, it should be fixed. --- g13d/g13.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g13d/g13.cc b/g13d/g13.cc index 040fa2f..ab6f08a 100644 --- a/g13d/g13.cc +++ b/g13d/g13.cc @@ -145,7 +145,7 @@ int g13_create_uinput(G13_Device *g13) { } memset(&uinp, 0, sizeof(uinp)); char name[] = "G13"; - strncpy(uinp.name, name, sizeof(name)); + strncpy(uinp.name, name, sizeof(uinp.name)); uinp.id.version = 1; uinp.id.bustype = BUS_USB; uinp.id.product = G13_PRODUCT_ID;