]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: set null termination explicitly
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 27 Sep 2012 23:02:21 +0000 (16:02 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 8 Oct 2012 22:15:08 +0000 (15:15 -0700)
Make sure that string is null terminated.
Fixes coverity issue.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_op.cc

index 71ad6d19fa2fee9b5b3134adadd305d055e94fe0..5ecd420cb8bec101e0b82509b0866eee54fa6d36 100644 (file)
@@ -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();