aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-20 20:50:59 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-20 20:51:13 +0100
commitb95a54eb684b318c37b1b108a94a6cbb721cf902 (patch)
tree7c534d12453f927547163a2f95b3ed66f10b6dc7
parent9f5e194b5bd1dcfd3fc9012f98e7ce7209b95267 (diff)
downloadrspamd-b95a54eb684b318c37b1b108a94a6cbb721cf902.tar.gz
rspamd-b95a54eb684b318c37b1b108a94a6cbb721cf902.zip
[Minor] Fix extensions calculations
-rw-r--r--src/fuzzy_storage.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index b8e3d49c2..f806cb87d 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -1249,7 +1249,6 @@ rspamd_fuzzy_extensions_from_wire (struct fuzzy_session *s, guchar *buf, gsize b
}
else if (cmd == RSPAMD_FUZZY_EXT_SOURCE_IP4) {
if (end - p >= sizeof (in_addr_t)) {
- p += sizeof (in_addr_t);
n_ext ++;
st_len += sizeof (in_addr_t);
}
@@ -1262,7 +1261,6 @@ rspamd_fuzzy_extensions_from_wire (struct fuzzy_session *s, guchar *buf, gsize b
}
else if (cmd == RSPAMD_FUZZY_EXT_SOURCE_IP6) {
if (end - p >= sizeof (struct in6_addr)) {
- p += sizeof (struct in6_addr);
n_ext ++;
st_len += sizeof (struct in6_addr);
}
@@ -1273,6 +1271,10 @@ rspamd_fuzzy_extensions_from_wire (struct fuzzy_session *s, guchar *buf, gsize b
p += sizeof (struct in6_addr);
}
+ else {
+ /* Invalid command */
+ return FALSE;
+ }
}
else {
/* Truncated extension */
@@ -1336,6 +1338,9 @@ rspamd_fuzzy_extensions_from_wire (struct fuzzy_session *s, guchar *buf, gsize b
data_buf += sizeof (struct in6_addr);
ext = ext->next;
}
+ else {
+ g_assert_not_reached ();
+ }
}
/* Last next should be NULL */