All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] telephony: ijx: buffer overflow in ixj_write_cid()
@ 2012-12-03 19:05 Dan Carpenter
  2012-12-03 19:10 ` Greg Kroah-Hartman
  2012-12-05  1:30 ` Chen Gang
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-12-03 19:05 UTC (permalink / raw)
  To: kernel-janitors

We get this from user space and nothing has been done to ensure that
these strings are NUL terminated.

Cc: stable@vger.kernel.org
Reported-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This driver is going to be removed in the 3.8 kernel but the fix is
needed for 3.7 and older.

diff --git a/drivers/staging/telephony/ixj.c b/drivers/staging/telephony/ixj.c
index 1cfa0b0..cf6aa83 100644
--- a/drivers/staging/telephony/ixj.c
+++ b/drivers/staging/telephony/ixj.c
@@ -3190,12 +3190,12 @@ static void ixj_write_cid(IXJ *j)
 
 	ixj_fsk_alloc(j);
 
-	strcpy(sdmf1, j->cid_send.month);
-	strcat(sdmf1, j->cid_send.day);
-	strcat(sdmf1, j->cid_send.hour);
-	strcat(sdmf1, j->cid_send.min);
-	strcpy(sdmf2, j->cid_send.number);
-	strcpy(sdmf3, j->cid_send.name);
+	strlcpy(sdmf1, j->cid_send.month, sizeof(sdmf1));
+	strlcat(sdmf1, j->cid_send.day, sizeof(sdmf1));
+	strlcat(sdmf1, j->cid_send.hour, sizeof(sdmf1));
+	strlcat(sdmf1, j->cid_send.min, sizeof(sdmf1));
+	strlcpy(sdmf2, j->cid_send.number, sizeof(sdmf2));
+	strlcpy(sdmf3, j->cid_send.name, sizeof(sdmf3));
 
 	len1 = strlen(sdmf1);
 	len2 = strlen(sdmf2);
@@ -3340,12 +3340,12 @@ static void ixj_write_cidcw(IXJ *j)
 		ixj_pre_cid(j);
 	}
 	j->flags.cidcw_ack = 0;
-	strcpy(sdmf1, j->cid_send.month);
-	strcat(sdmf1, j->cid_send.day);
-	strcat(sdmf1, j->cid_send.hour);
-	strcat(sdmf1, j->cid_send.min);
-	strcpy(sdmf2, j->cid_send.number);
-	strcpy(sdmf3, j->cid_send.name);
+	strlcpy(sdmf1, j->cid_send.month, sizeof(sdmf1));
+	strlcat(sdmf1, j->cid_send.day, sizeof(sdmf1));
+	strlcat(sdmf1, j->cid_send.hour, sizeof(sdmf1));
+	strlcat(sdmf1, j->cid_send.min, sizeof(sdmf1));
+	strlcpy(sdmf2, j->cid_send.number, sizeof(sdmf2));
+	strlcpy(sdmf3, j->cid_send.name, sizeof(sdmf3));
 
 	len1 = strlen(sdmf1);
 	len2 = strlen(sdmf2);

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

* Re: [patch] telephony: ijx: buffer overflow in ixj_write_cid()
  2012-12-03 19:05 [patch] telephony: ijx: buffer overflow in ixj_write_cid() Dan Carpenter
@ 2012-12-03 19:10 ` Greg Kroah-Hartman
  2012-12-05  1:30 ` Chen Gang
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2012-12-03 19:10 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Dec 03, 2012 at 10:05:12PM +0300, Dan Carpenter wrote:
> We get this from user space and nothing has been done to ensure that
> these strings are NUL terminated.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Chen Gang <gang.chen@asianux.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This driver is going to be removed in the 3.8 kernel but the fix is
> needed for 3.7 and older.

Ok, I'll queue it up for 3.7.1 and older stable kernels at that time, as
it's too late for 3.7-final right now, especially as no one is even
using this code :)

thanks,

greg k-h

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

* Re: [patch] telephony: ijx: buffer overflow in ixj_write_cid()
  2012-12-03 19:05 [patch] telephony: ijx: buffer overflow in ixj_write_cid() Dan Carpenter
  2012-12-03 19:10 ` Greg Kroah-Hartman
@ 2012-12-05  1:30 ` Chen Gang
  1 sibling, 0 replies; 3+ messages in thread
From: Chen Gang @ 2012-12-05  1:30 UTC (permalink / raw)
  To: kernel-janitors

于 2012年12月04日 03:10, Greg Kroah-Hartman 写道:
> On Mon, Dec 03, 2012 at 10:05:12PM +0300, Dan Carpenter wrote:
>> We get this from user space and nothing has been done to ensure that
>> these strings are NUL terminated.
>>
>> Cc: stable@vger.kernel.org
>> Reported-by: Chen Gang <gang.chen@asianux.com>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>> This driver is going to be removed in the 3.8 kernel but the fix is
>> needed for 3.7 and older.
> 
> Ok, I'll queue it up for 3.7.1 and older stable kernels at that time, as
> it's too late for 3.7-final right now, especially as no one is even
> using this code :)
> 
> thanks,
> 
> greg k-h
> 
> 

  thank you very much.

  :-)

-- 
Chen Gang

Asianux Corporation

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

end of thread, other threads:[~2012-12-05  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03 19:05 [patch] telephony: ijx: buffer overflow in ixj_write_cid() Dan Carpenter
2012-12-03 19:10 ` Greg Kroah-Hartman
2012-12-05  1:30 ` Chen Gang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.