From acb3053904f40cfaa8e97030fc95d3447f522373 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 27 Sep 2012 16:02:21 -0700 Subject: [PATCH] rgw: set null termination explicitly Make sure that string is null terminated. Fixes coverity issue. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_op.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 71ad6d19fa2fe..5ecd420cb8bec 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1184,7 +1184,8 @@ void RGWPutObj::execute() } if (supplied_etag) { - strncpy(supplied_md5, supplied_etag, sizeof(supplied_md5)); + strncpy(supplied_md5, supplied_etag, sizeof(supplied_md5) - 1); + supplied_md5[sizeof(supplied_md5) - 1] = '\0'; } processor = select_processor(); -- 2.39.5