Fix DOM filter so that full record ID (z:id) if given is used verbatim
rather than truncated until first blank - in other words use memcpy
rather than sscanf. For PI fix record attributes parsing which was completely
broken.
- sscanf((const char *)id_p, "%255s", extctr->match_criteria);
+ {
+ size_t l = strlen(id_p);
+ if (l >= sizeof(extctr->match_criteria))
+ l = sizeof(extctr->match_criteria)-1;
+ memcpy(extctr->match_criteria, id_p, l);
+ extctr->match_criteria[l] = '\0';
+ }
if (rank_p && *rank_p)
extctr->staticrank = atozint((const char *)rank_p);
if (rank_p && *rank_p)
extctr->staticrank = atozint((const char *)rank_p);
const char *look = *c_ptr;
int ret = 0;
const char *look = *c_ptr;
int ret = 0;
- *value = '\0';
- while (*look && ' ' == *look)
- look++;
if (strlen(look) > name_len)
{
if (look[name_len] == '=' && !memcmp(look, name, name_len))
if (strlen(look) > name_len)
{
if (look[name_len] == '=' && !memcmp(look, name, name_len))
- while (*look && ' ' == *look)
- look++;
*c_ptr = look;
return ret;
}
*c_ptr = look;
return ret;
}
*rank = '\0';
*type = '\0';
look += 6;
*rank = '\0';
*type = '\0';
look += 6;
+ for (;;)
+ {
+ /* eat whitespace */
+ while (' ' == *look)
+ look++;
+ if (*look == '\0')
+ break;
if (attr_content_pi(&look, "id", id, sizeof(id)))
;
else if (attr_content_pi(&look, "rank", rank, sizeof(rank)))
;
else if (attr_content_pi(&look, "type", type, sizeof(type)))
if (attr_content_pi(&look, "id", id, sizeof(id)))
;
else if (attr_content_pi(&look, "rank", rank, sizeof(rank)))
;
else if (attr_content_pi(&look, "type", type, sizeof(type)))
{
dom_log(YLOG_WARN, tinfo, node,
"content '%s', can not parse '%s'",
pi_p, look);
break;
}
{
dom_log(YLOG_WARN, tinfo, node,
"content '%s', can not parse '%s'",
pi_p, look);
break;
}
set_record_info(tinfo, extctr, node, id, rank, type);
}
/* parsing index instruction */
set_record_info(tinfo, extctr, node, id, rank, type);
}
/* parsing index instruction */