diff options
author | Sage Weil <sage@inktank.com> | 2012-11-29 15:34:32 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-11-29 15:34:32 -0800 |
commit | ef39773c18fddfddaceebecec608173323888e82 (patch) | |
tree | 844dc9c99fceaa8d9bc7b44552e9c11230548920 | |
parent | 6a69083dcee58bb411f6d81d80055767e1160f27 (diff) | |
parent | 079dd190446bedb928518f095933c9881011fa43 (diff) | |
download | ceph-ef39773c18fddfddaceebecec608173323888e82.tar.gz |
Merge remote-tracking branch 'gh/wip-mon-osd-create-fix' into next
-rw-r--r-- | src/mon/Monitor.cc | 5 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 5edecfc14c8..91db2b0c20f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -83,6 +83,11 @@ static ostream& _prefix(std::ostream *_dout, const Monitor *mon) { long parse_pos_long(const char *s, ostream *pss) { + if (*s == '-' || *s == '+') { + *pss << "expected numerical value, got: " << s; + return -EINVAL; + } + string err; long r = strict_strtol(s, 10, &err); if ((r == 0) && !err.empty()) { diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 94e08b87088..c845c2b600c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2447,7 +2447,11 @@ bool OSDMonitor::prepare_command(MMonCommand *m) // optional uuid provided? uuid_d uuid; - if (m->cmd.size() > 2 && uuid.parse(m->cmd[2].c_str())) { + if (m->cmd.size() > 2) { + if (!uuid.parse(m->cmd[2].c_str())) { + err = -EINVAL; + goto out; + } dout(10) << " osd create got uuid " << uuid << dendl; i = osdmap.identify_osd(uuid); if (i >= 0) { |