Chen Gang ff0102ee10 net: irda: using kzalloc() instead of kmalloc() to avoid strncpy() issue.
'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@asianux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-05-19 15:10:47 -07:00
..
2012-07-16 23:23:52 -07:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2010-09-23 14:33:39 -07:00
2013-04-25 01:42:06 -04:00
2012-06-04 11:45:11 -04:00
2007-07-10 22:16:43 -07:00