* [patch] isdn: fix strlen() usage
@ 2010-07-10 14:31 Dan Carpenter
2010-07-13 3:34 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-07-10 14:31 UTC (permalink / raw)
To: Karsten Keil
Cc: Stephen Hemminger, David S. Miller, Dirk Hohndel, Jiri Kosina,
netdev, kernel-janitors
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>
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 8c85d1e..26d44c3 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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-13 3:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10 14:31 [patch] isdn: fix strlen() usage Dan Carpenter
2010-07-13 3:34 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).