From: Dan Carpenter Date: Thu, 24 Nov 2011 02:42:09 +0000 (+0000) Subject: isdn: avoid copying too long drvid X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5dc5503f5a400be5a7dc611745a034f04b0679b8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git isdn: avoid copying too long drvid "cfg->drvid" comes from the user so there is a possibility they didn't NUL terminate it properly. Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 1f73d7f7e024..2339d7396b9e 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -2756,6 +2756,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) char *c, *e; + if (strnlen(cfg->drvid, sizeof(cfg->drvid)) == + sizeof(cfg->drvid)) + return -EINVAL; drvidx = -1; chidx = -1; strcpy(drvid, cfg->drvid);