diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-05-16 23:13:04 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-19 15:10:47 -0700 |
commit | ff0102ee104847023c36357e2b9f133f3f40d211 (patch) | |
tree | 02e2f942ee44e5a49efdfff22d41fb1fee382e45 /net/decnet | |
parent | 6b21e1b77d1a3d58ebfd513264c885695e8a0ba5 (diff) | |
download | linux-ff0102ee104847023c36357e2b9f133f3f40d211.tar.gz linux-ff0102ee104847023c36357e2b9f133f3f40d211.tar.bz2 linux-ff0102ee104847023c36357e2b9f133f3f40d211.zip |
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>
Diffstat (limited to 'net/decnet')
0 files changed, 0 insertions, 0 deletions