commit f06db7c: [Minor] Fix order of checks
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Jul 21 14:14:06 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-07-21 15:10:36 +0100
URL: https://github.com/rspamd/rspamd/commit/f06db7c896b340d3862cfa4417d08256ae36f33f
[Minor] Fix order of checks
---
src/libserver/html/html_entities.cxx | 6 +++---
1 file 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;
}
More information about the Commits
mailing list