]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_json: don't try to parse NULL buffer
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 2 May 2013 19:41:57 +0000 (12:41 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 15 May 2013 01:52:32 +0000 (18:52 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/common/ceph_json.cc

index 502ffb58e70aac5875571f6a82052808a086267b..04b21206ce8bf2082cdef6304f459f965adb79a5 100644 (file)
@@ -217,6 +217,11 @@ void JSONParser::handle_data(const char *s, int len)
 // parse a supplied JSON fragment
 bool JSONParser::parse(const char *buf_, int len)
 {
+  if (!buf_) {
+    set_failure();
+    return false;
+  }
+
   string json_string = buf_;
   // make a substring to len
   json_string = json_string.substr(0, len);