fix issue: fmClient segfaults on short string parameter

It is due to out of range access violation. Fix it by checking length
before access.

Closes-Bug: 1807986

Change-Id: Iba2b445f50fd98a74d932c9b3f691fc7145274bb
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
This commit is contained in:
Shuicheng Lin 2019-01-26 01:19:38 +08:00
parent 80a9ad661f
commit 6493976162

View File

@ -205,6 +205,8 @@ static std::string chkstr(const std::string &s) {
static void str_to_vector(const std::string &s, std::vector<std::string> &alarm) {
size_t offset = 0;
alarm.clear();
if (s.length() <= 3)
return ;
while (true) {
size_t beg = (offset==0) ? 0 : s.find("###",offset);
if (beg==std::string::npos) break;