summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lnet/selftest/conrpc.c
diff options
context:
space:
mode:
authorDmitry Eremin <dmitry.eremin@intel.com>2015-11-04 13:40:00 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-23 08:44:22 +0100
commitfcee2927c0578c07c16f211b3bb674734032bb18 (patch)
tree5181734fd9d12b523c9818f1995ae4c20eb2b64f /drivers/staging/lustre/lnet/selftest/conrpc.c
parentb48715dcf16b4379823ae64b08c2d2cfd13a6432 (diff)
staging: lustre: fix buffer overflow of string buffer
commit 9563fe8a2de9db5eb087fe0e48ec335ee66f8f41 upstream. Buffer overflow of string buffer due to non null terminated string. Use strlcpy() when it's justifiable. Use sizeof(var) instead of constants. Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-on: http://review.whamcloud.com/9389 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/selftest/conrpc.c')
-rw-r--r--drivers/staging/lustre/lnet/selftest/conrpc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 64a0335934f3..1066c70434b1 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -612,8 +612,8 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop,
msrq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.mksn_reqst;
msrq->mksn_sid = console_session.ses_id;
msrq->mksn_force = console_session.ses_force;
- strncpy(msrq->mksn_name, console_session.ses_name,
- strlen(console_session.ses_name));
+ strlcpy(msrq->mksn_name, console_session.ses_name,
+ sizeof(msrq->mksn_name));
break;
case LST_TRANS_SESEND: