]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: check for second argument to mv/rename
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 9 Nov 2012 20:11:18 +0000 (12:11 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Fri, 9 Nov 2012 20:17:50 +0000 (12:17 -0800)
Without this check, 'rbd mv foo' crashed trying to use a NULL char* as
a string.

Reported-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/rbd.cc

index 2e3b0293dc3b59d863e80107189a1347701361b3..fa7648a2148152d08749c76e53fc97f674a4ef9d 100644 (file)
@@ -1660,7 +1660,8 @@ if (!set_conf_param(v, p1, p2, p3)) { \
   if (opt_cmd == OPT_EXPORT && !path)
     path = imgname;
 
-  if ((opt_cmd == OPT_COPY || opt_cmd == OPT_CLONE) && !destname ) {
+  if ((opt_cmd == OPT_COPY || opt_cmd == OPT_CLONE || opt_cmd == OPT_RENAME) &&
+      !destname ) {
     cerr << "rbd: destination image name was not specified" << std::endl;
     return EXIT_FAILURE;
   }