From 34ebda2bab08d310063296e2cf8752a84a317cf7 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Fri, 9 Nov 2012 12:11:18 -0800 Subject: [PATCH] rbd: check for second argument to mv/rename Without this check, 'rbd mv foo' crashed trying to use a NULL char* as a string. Reported-by: Andrey Korolyov Signed-off-by: Josh Durgin --- src/rbd.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rbd.cc b/src/rbd.cc index 2e3b0293dc3b5..fa7648a214815 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -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; } -- 2.39.5