From 0ffce067def1242e0f70fd6aeb8512a21f6bfa07 Mon Sep 17 00:00:00 2001 From: wang di Date: Sun, 22 Mar 2015 08:15:19 -0700 Subject: [PATCH] LU-6395 mgc: one byte shorter for logname allocation One byte shorter for logname allocation in mgc_llog_local_copy(), which might cause buffer overflow in the following sprintf(). Signed-off-by: wang di Change-Id: Ie758c3650c1cf7848874d9fd3a02a5618043eb8f Reviewed-on: http://review.whamcloud.com/14146 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Tested-by: Maloo --- lustre/mgc/mgc_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index c14e760..72827eb 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -1717,7 +1717,7 @@ static int mgc_llog_local_copy(const struct lu_env *env, * - if failed then move bakup to logname again */ - OBD_ALLOC(temp_log, strlen(logname) + 1); + OBD_ALLOC(temp_log, strlen(logname) + 2); if (!temp_log) RETURN(-ENOMEM); sprintf(temp_log, "%sT", logname); @@ -1739,7 +1739,7 @@ out: obd->obd_name, logname, rc); } llog_erase(env, lctxt, NULL, temp_log); - OBD_FREE(temp_log, strlen(logname) + 1); + OBD_FREE(temp_log, strlen(logname) + 2); return rc; } -- 1.8.3.1