netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] isdn: make sure strings are null terminated
@ 2011-11-23  6:42 Dan Carpenter
  2011-11-23  7:03 ` Eric Dumazet
  2011-11-23  8:25 ` [patch] " walter harms
  0 siblings, 2 replies; 10+ messages in thread
From: Dan Carpenter @ 2011-11-23  6:42 UTC (permalink / raw)
  To: Karsten Keil; +Cc: netdev, kernel-janitors

These strings come from the user.  We strcpy() them inside
cf_command() so we should check that they are NULL terminated and
return an error if not.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c
index 33ec9e4..0c16687 100644
--- a/drivers/isdn/divert/divert_procfs.c
+++ b/drivers/isdn/divert/divert_procfs.c
@@ -242,6 +242,10 @@ static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg)
 		case IIOCDOCFINT:
 			if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid))
 				return (-EINVAL);	/* invalid driver */
+			if (strlen(dioctl.cf_ctrl.msn) >= sizeof(dioctl.cf_ctrl.msn))
+				return -EINVAL;
+			if (strlen(dioctl.cf_ctrl.fwd_nr) >= sizeof(dioctl.cf_ctrl.fwd_nr))
+				return -EINVAL;
 			if ((i = cf_command(dioctl.cf_ctrl.drvid,
 					    (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2,
 					    dioctl.cf_ctrl.cfproc,

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-11-29 23:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23  6:42 [patch] isdn: make sure strings are null terminated Dan Carpenter
2011-11-23  7:03 ` Eric Dumazet
2011-11-23  7:16   ` Dan Carpenter
2011-11-24 12:41   ` [patch v2] " Dan Carpenter
2011-11-29 23:40     ` David Miller
2011-11-23  8:25 ` [patch] " walter harms
2011-11-24 11:34   ` Dan Carpenter
2011-11-24 12:21     ` walter harms
2011-11-24 12:30       ` David Laight
2011-11-24 13:17       ` Karsten Keil

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).