Skip to content

Commit

Permalink
isdn: fix strlen() usage
Browse files Browse the repository at this point in the history
There was a missing "else" statement so the original code overflowed if
->master->name was too long.  Also the ->slave and ->master buffers can
hold names with 9 characters and a NULL so I cleaned it up to allow
another character.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Jul 13, 2010
1 parent 5c4bfa1 commit 84ce981
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/isdn/i4l/isdn_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -2924,16 +2924,17 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1;
cfg->dialwait = lp->dialwait / HZ;
if (lp->slave) {
if (strlen(lp->slave->name) > 8)
if (strlen(lp->slave->name) >= 10)
strcpy(cfg->slave, "too-long");
else
strcpy(cfg->slave, lp->slave->name);
} else
cfg->slave[0] = '\0';
if (lp->master) {
if (strlen(lp->master->name) > 8)
if (strlen(lp->master->name) >= 10)
strcpy(cfg->master, "too-long");
strcpy(cfg->master, lp->master->name);
else
strcpy(cfg->master, lp->master->name);
} else
cfg->master[0] = '\0';
return 0;
Expand Down

0 comments on commit 84ce981

Please sign in to comment.