diff options
author | Dan Carpenter <error27@gmail.com> | 2010-07-10 06:31:11 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-13 05:21:43 +0200 |
commit | 84ce981a076c6b2d3efec66bf92a91d1aa80c983 (patch) | |
tree | 901ef430a4acbab2e2d92a15f7146b9e709e3eb0 /drivers/isdn/i4l | |
parent | 9p: strlen() doesn't count the terminator (diff) | |
download | linux-84ce981a076c6b2d3efec66bf92a91d1aa80c983.tar.xz linux-84ce981a076c6b2d3efec66bf92a91d1aa80c983.zip |
isdn: fix strlen() usage
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>
Diffstat (limited to 'drivers/isdn/i4l')
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 8c85d1e88cc6..26d44c3ca1d8 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -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; |