commit a941c55: [Minor] Sigh, one more fix to the conditions

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Dec 26 20:14:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-12-26 20:09:14 +0000
URL: https://github.com/rspamd/rspamd/commit/a941c5524852826f904f5f53e3867081cc7c36ec (HEAD -> master)

[Minor] Sigh, one more fix to the conditions

---
 src/libserver/css/css_tokeniser.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserver/css/css_tokeniser.cxx b/src/libserver/css/css_tokeniser.cxx
index fe547d82c..737b3460d 100644
--- a/src/libserver/css/css_tokeniser.cxx
+++ b/src/libserver/css/css_tokeniser.cxx
@@ -363,12 +363,12 @@ auto css_tokeniser::consume_number() -> struct css_parser_token
 	if (i > offset) {
 		/* I wish it was supported properly */
 		//auto conv_res = std::from_chars(&input[offset], &input[i], num);
-		char numbuf[128], *endptr = NULL;
+		char numbuf[128], *endptr = nullptr;
 		rspamd_strlcpy(numbuf, &input[offset], MIN(i - offset + 1, sizeof(numbuf)));
 		auto num = g_ascii_strtod(numbuf, &endptr);
 		offset = i;
 
-		if ((endptr && *endptr != '\0') || num >= G_MAXFLOAT || num <= G_MINFLOAT || std::isnan(num)) {
+		if (fabs (num) >= G_MAXFLOAT || std::isnan(num)) {
 			msg_debug_css("invalid number: %s", numbuf);
 			return make_token<css_parser_token::token_type::delim_token>(input[i - 1]);
 		}


More information about the Commits mailing list