diff --git a/src/mhd2/mhd_str.c b/src/mhd2/mhd_str.c index 41195429..05eaebc7 100644 --- a/src/mhd2/mhd_str.c +++ b/src/mhd2/mhd_str.c @@ -1596,15 +1596,18 @@ mhd_hex_to_bin (const char *restrict hex, if (0 != len % 2) { /* Assume the first byte is encoded with single digit */ - const int l = toxdigitvalue (hex[r++]); + const char c2 = hex[r++]; + const int l = toxdigitvalue (c2); if (0 > l) return 0; ((uint8_t *) bin)[w++] = (uint8_t) ((unsigned int) l); } while (r < len) { - const int h = toxdigitvalue (hex[r++]); - const int l = toxdigitvalue (hex[r++]); + const char c1 = hex[r++]; + const char c2 = hex[r++]; + const int h = toxdigitvalue (c1); + const int l = toxdigitvalue (c2); if ((0 > h) || (0 > l)) return 0; ((uint8_t *) bin)[w++] = (uint8_t) ( ((uint8_t) (((uint8_t) @@ -1649,8 +1652,10 @@ mhd_str_pct_decode_strict_n (const char *pct_encoded, return 0; else { - const int h = toxdigitvalue (pct_encoded[++r]); - const int l = toxdigitvalue (pct_encoded[++r]); + const char c1 = pct_encoded[++r]; + const char c2 = pct_encoded[++r]; + const int h = toxdigitvalue (c1); + const int l = toxdigitvalue (c2); unsigned char out; if ((0 > h) || (0 > l)) return 0; @@ -1679,8 +1684,10 @@ mhd_str_pct_decode_strict_n (const char *pct_encoded, return 0; else { - const int h = toxdigitvalue (pct_encoded[++r]); - const int l = toxdigitvalue (pct_encoded[++r]); + const char c1 = pct_encoded[++r]; + const char c2 = pct_encoded[++r]; + const int h = toxdigitvalue (c1); + const int l = toxdigitvalue (c2); unsigned char out; if ((0 > h) || (0 > l)) return 0; @@ -1729,8 +1736,10 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded, } else { - const int h = toxdigitvalue (pct_encoded[++r]); - const int l = toxdigitvalue (pct_encoded[++r]); + const char c1 = pct_encoded[++r]; + const char c2 = pct_encoded[++r]; + const int h = toxdigitvalue (c1); + const int l = toxdigitvalue (c2); unsigned char out; if ((0 > h) || (0 > l)) { @@ -1771,8 +1780,10 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded, } else { - const int h = toxdigitvalue (pct_encoded[++r]); - const int l = toxdigitvalue (pct_encoded[++r]); + const char c1 = pct_encoded[++r]; + const char c2 = pct_encoded[++r]; + const int h = toxdigitvalue (c1); + const int l = toxdigitvalue (c2); if ((0 > h) || (0 > l)) { r -= 2;