From: Vsevolod Stakhov Date: Wed, 21 Jul 2021 14:10:36 +0000 (+0100) Subject: [Minor] Fix order of checks X-Git-Tag: 3.0~121 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f06db7c896b340d3862cfa4417d08256ae36f33f;p=rspamd.git [Minor] Fix order of checks --- diff --git a/src/libserver/html/html_entities.cxx b/src/libserver/html/html_entities.cxx index 95eb9f988..912da6e58 100644 --- a/src/libserver/html/html_entities.cxx +++ b/src/libserver/html/html_entities.cxx @@ -2300,7 +2300,7 @@ decode_html_entitles_inplace(char *s, std::size_t len, bool norm_spaces) int n = 0; /* Avoid INT_MIN overflow by moving to negative numbers */ - while (g_ascii_isdigit(*str) && len > 0) { + while (len > 0 && g_ascii_isdigit(*str)) { n = 10 * n - (*str++ - '0'); len --; } @@ -2316,7 +2316,7 @@ decode_html_entitles_inplace(char *s, std::size_t len, bool norm_spaces) int n = 0; /* Avoid INT_MIN overflow by moving to negative numbers */ - while (g_ascii_isxdigit(*str) && len > 0) { + while (len > 0 && g_ascii_isxdigit(*str)) { if (*str <= 0x39) { n = 16 * n - (*str++ - '0'); } @@ -2337,7 +2337,7 @@ decode_html_entitles_inplace(char *s, std::size_t len, bool norm_spaces) int n = 0; /* Avoid INT_MIN overflow by moving to negative numbers */ - while (g_ascii_isdigit(*str) && len > 0) { + while (len > 0 && g_ascii_isdigit(*str)) { if (*str > '7') { break; }