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.
This commit is contained in:
June Tate-Gans 2021-04-25 14:30:46 -05:00
parent ae055495cc
commit 19faa21256

View File

@ -145,7 +145,7 @@ int g13_create_uinput(G13_Device *g13) {
} }
memset(&uinp, 0, sizeof(uinp)); memset(&uinp, 0, sizeof(uinp));
char name[] = "G13"; char name[] = "G13";
strncpy(uinp.name, name, sizeof(name)); strncpy(uinp.name, name, sizeof(uinp.name));
uinp.id.version = 1; uinp.id.version = 1;
uinp.id.bustype = BUS_USB; uinp.id.bustype = BUS_USB;
uinp.id.product = G13_PRODUCT_ID; uinp.id.product = G13_PRODUCT_ID;