commit 1e7d04a: [Minor] Handle null values

Vsevolod Stakhov vsevolod at rspamd.com
Fri Aug 12 22:56:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-08-12 21:52:28 +0100
URL: https://github.com/rspamd/rspamd/commit/1e7d04a8a1e9f7b3d246f01a131a3edc8fa81682 (HEAD -> master)

[Minor] Handle null values

---
 src/libserver/symcache/symcache_c.cxx | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx
index 6ab1206c0..bd1c1abc4 100644
--- a/src/libserver/symcache/symcache_c.cxx
+++ b/src/libserver/symcache/symcache_c.cxx
@@ -106,6 +106,11 @@ rspamd_symcache_add_symbol_augmentation(struct rspamd_symcache *cache,
 		return false;
 	}
 
+	/* Handle empty or absent strings equally */
+	if (value == nullptr || value[0] == '\0') {
+		return item->add_augmentation(*real_cache, augmentation, std::nullopt);
+	}
+
 	return item->add_augmentation(*real_cache, augmentation, value);
 }
 


More information about the Commits mailing list