]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Sigh, one more fix to the conditions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 26 Dec 2021 20:09:14 +0000 (20:09 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 26 Dec 2021 20:09:14 +0000 (20:09 +0000)
src/libserver/css/css_tokeniser.cxx

index fe547d82cef4752d62cfb04c651f1aa86360dcf1..737b3460df361c49252d2197fc093b44a3347ab4 100644 (file)
@@ -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]);
                }