Skip to content

Commit

Permalink
isdn: avoid copying too long drvid
Browse files Browse the repository at this point in the history
"cfg->drvid" comes from the user so there is a possibility they
didn't NUL terminate it properly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Nov 29, 2011
1 parent 746ae30 commit 5dc5503
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/isdn/i4l/isdn_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5dc5503

Please sign in to comment.