]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/hid/hid-logitech-hidpp.c
HID: logitech-hidpp: add boundary check for name retrieval
[mirror_ubuntu-artful-kernel.git] / drivers / hid / hid-logitech-hidpp.c
index 4d72c20fa233427e46de1655178cd850398e7da2..4292cc33c11974fc09ec82142f6cb74aa5084ea6 100644 (file)
@@ -313,6 +313,9 @@ static char *hidpp_get_unifying_name(struct hidpp_device *hidpp_dev)
 
        len = response.rap.params[1];
 
+       if (2 + len > sizeof(response.rap.params))
+               return NULL;
+
        name = kzalloc(len + 1, GFP_KERNEL);
        if (!name)
                return NULL;