[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <519976AA.2010901@asianux.com>
Date: Mon, 20 May 2013 09:04:42 +0800
From: Chen Gang <gang.chen@...anux.com>
To: David Miller <davem@...emloft.net>
CC: samuel@...tiz.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: irda: using kzalloc() instead of kmalloc() to avoid
strncpy() issue.
On 05/20/2013 06:11 AM, David Miller wrote:
> From: Chen Gang <gang.chen@...anux.com>
> Date: Fri, 17 May 2013 17:13:04 +0800
>
>> >
>> > 'discovery->data.info' length is 22, NICKNAME_MAX_LEN is 21, so the
>> > strncpy() will always left the last byte of 'discovery->data.info'
>> > uninitialized.
>> >
>> > When 'text' length is longer than 21 (NICKNAME_MAX_LEN), if still left
>> > the last byte of 'discovery->data.info' uninitialized, the next
>> > strlen() will cause issue.
>> >
>> > Also 'discovery->data' is 'struct irda_device_info' which defined in
>> > "include/uapi/...", it may copy to user mode, so need whole initialized.
>> >
>> > All together, need use kzalloc() instead of kmalloc() to initialize all
>> > members firstly.
>> >
>> > Signed-off-by: Chen Gang <gang.chen@...anux.com>
> Applied, thanks.
>
>
Thank you, too.
Thanks.
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists