diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-05-02 09:05:28 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-13 22:08:16 (GMT) |
commit | 0f6e8aab94035f5a649195a2179813bc3db98272 (patch) | |
tree | 31e988ba451f2312af345effbd683ff02629f96a /drivers/staging/dgrp/dgrp_net_ops.c | |
parent | 205179d0c02cb3f59eda77d3e6cc895b7d4b06bd (diff) | |
download | linux-fsl-qoriq-0f6e8aab94035f5a649195a2179813bc3db98272.tar.xz |
staging: for dgrp, let nd_ps_desc always NUL terminated string within MAX_DESC_LEN length
Use strlcpy instead of strncpy to let nd_ps_desc always NUL terminated.
Change nd_ps_desc in nd_struct struct to MAX_DESC_LEN to avoid the
confusion (the related length checking also need be changed to
MAX_DESC_LEN - 1).
Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/dgrp/dgrp_net_ops.c')
-rw-r--r-- | drivers/staging/dgrp/dgrp_net_ops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c index 6cf7672..7a0d72d 100644 --- a/drivers/staging/dgrp/dgrp_net_ops.c +++ b/drivers/staging/dgrp/dgrp_net_ops.c @@ -3083,7 +3083,7 @@ check_query: nd->nd_hw_ver = (b[8] << 8) | b[9]; nd->nd_sw_ver = (b[10] << 8) | b[11]; nd->nd_hw_id = b[6]; - desclen = ((plen - 12) > MAX_DESC_LEN) ? MAX_DESC_LEN : + desclen = (plen - 12 > MAX_DESC_LEN - 1) ? MAX_DESC_LEN - 1 : plen - 12; if (desclen <= 0) { |