[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130519.151112.787320797896644755.davem@davemloft.net>
Date: Sun, 19 May 2013 15:11:12 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: gang.chen@...anux.com
Cc: samuel@...tiz.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: irda: using kzalloc() instead of kmalloc() to
avoid strncpy() issue.
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.
--
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