]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: handle empty POST condition 11809/head
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 20 Oct 2016 17:17:36 +0000 (10:17 -0700)
committerNathan Cutler <ncutler@suse.com>
Mon, 7 Nov 2016 10:00:23 +0000 (11:00 +0100)
Fixes: http://tracker.ceph.com/issues/17635
Before accessing json entity, need to check that iterator is valid.
If there is no entry return appropriate error code.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 23cb642243e09ca4a8e104f62a3bb7b2cbb6ea12)

src/rgw/rgw_policy_s3.cc

index 3843511775d398e33e2b781da600e9a46e2cf6f5..8af70a832223af18dbd19edf6a53d18ed833bc32 100644 (file)
@@ -286,11 +286,13 @@ int RGWPolicy::from_json(bufferlist& bl, string& err_msg)
       int r = add_condition(v[0], v[1], v[2], err_msg);
       if (r < 0)
         return r;
-    } else {
+    } else if (!citer.end()) {
       JSONObj *c = *citer;
       dout(0) << "adding simple_check: " << c->get_name() << " : " << c->get_data() << dendl;
 
       add_simple_check(c->get_name(), c->get_data());
+    } else {
+      return -EINVAL;
     }
   }
   return 0;