cur = cfg->classifiers;
while (cur) {
+ bk = NULL;
clf = cur->data;
cl = g_slice_alloc0 (sizeof (*cl));
cl->cfg = clf;
st->classifier = cl;
st->stcf = stf;
- if (!(cl->cfg->flags & RSPAMD_FLAG_CLASSIFIER_NO_BACKEND)) {
+ if (!(cl->cfg->flags & RSPAMD_FLAG_CLASSIFIER_NO_BACKEND) && bk) {
st->backend = bk;
st->bkcf = bk->init (stat_ctx, cfg, st);
msg_debug_config ("added backend %s for symbol %s",
/* Compare the first bytes */
bmask = mask / CHAR_BIT;
- if (bmask > addrlen) {
+ if (mask > addrlen * CHAR_BIT) {
msg_info_task ("bad mask length: %d", mask);
}
else if (memcmp (s, d, bmask) == 0) {
-
- if (bmask * CHAR_BIT != mask) {
+ if (bmask * CHAR_BIT < mask) {
/* Compare the remaining bits */
s += bmask;
d += bmask;
mask = (0xff << (CHAR_BIT - (mask - bmask * 8))) & 0xff;
+
if ((*s & mask) == (*d & mask)) {
res = TRUE;
}