From: Yehuda Sadeh Date: Thu, 2 May 2013 19:41:57 +0000 (-0700) Subject: ceph_json: don't try to parse NULL buffer X-Git-Tag: v0.67-rc1~128^2~118 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3c8ef2b9025824cfaa2fa0ed93ab0a31a9dbcd68;p=ceph.git ceph_json: don't try to parse NULL buffer Signed-off-by: Yehuda Sadeh --- diff --git a/src/common/ceph_json.cc b/src/common/ceph_json.cc index 502ffb58e70a..04b21206ce8b 100644 --- a/src/common/ceph_json.cc +++ b/src/common/ceph_json.cc @@ -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);