]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mei: bus: fix possible boundaries violation
authorAlexander Usyskin <alexander.usyskin@intel.com>
Mon, 25 Aug 2014 13:46:53 +0000 (16:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Oct 2014 16:43:09 +0000 (09:43 -0700)
commit cfda2794b5afe7ce64ee9605c64bef0e56a48125 upstream.

function 'strncpy' will fill whole buffer 'id.name' of fixed size (32)
with string value and will not leave place for NULL-terminator.
Possible buffer boundaries violation in following string operations.
Replace strncpy with strlcpy.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/bus.c

index 0e993ef28b94ff23272b0a3d2f57e87f73da6c3b..8fd9466266b6cbd7287769eb04313cff23f26ffe 100644 (file)
@@ -70,7 +70,7 @@ static int mei_cl_device_probe(struct device *dev)
 
        dev_dbg(dev, "Device probe\n");
 
-       strncpy(id.name, dev_name(dev), sizeof(id.name));
+       strlcpy(id.name, dev_name(dev), sizeof(id.name));
 
        return driver->probe(device, &id);
 }