From 3c8ef2b9025824cfaa2fa0ed93ab0a31a9dbcd68 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 2 May 2013 12:41:57 -0700 Subject: [PATCH] ceph_json: don't try to parse NULL buffer Signed-off-by: Yehuda Sadeh --- src/common/ceph_json.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/ceph_json.cc b/src/common/ceph_json.cc index 502ffb58e70aa..04b21206ce8bf 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); -- 2.39.5