aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-21 15:10:36 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-21 15:10:36 +0100
commitf06db7c896b340d3862cfa4417d08256ae36f33f (patch)
tree0d5bc3d058bbaebeafb98c88a4c223a8fff6eefe
parent447b26b3751abf5d1e0f276e4a409c9f9e6e7fd4 (diff)
downloadrspamd-f06db7c896b340d3862cfa4417d08256ae36f33f.tar.gz
rspamd-f06db7c896b340d3862cfa4417d08256ae36f33f.zip
[Minor] Fix order of checks
-rw-r--r--src/libserver/html/html_entities.cxx6
1 files changed, 3 insertions, 3 deletions
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;
}