diff --git a/IDE/iotsafe/devices.c b/IDE/iotsafe/devices.c index f63fd85834a..bdb03cb4907 100644 --- a/IDE/iotsafe/devices.c +++ b/IDE/iotsafe/devices.c @@ -219,7 +219,7 @@ int _write(void *r, uint8_t *text, int len) { char *p = (char *)text; (void)r; - while(*p && (p < (char *)(text + len))) { + while((p < (char *)(text + len)) && *p) { usart_tx(USART2_BASE, *p); p++; } diff --git a/wolfcrypt/src/port/Espressif/esp32_mp.c b/wolfcrypt/src/port/Espressif/esp32_mp.c index 124d3d23584..bbe78071120 100644 --- a/wolfcrypt/src/port/Espressif/esp32_mp.c +++ b/wolfcrypt/src/port/Espressif/esp32_mp.c @@ -720,18 +720,18 @@ static int esp_clean_result(MATH_INT_T* Z, int used_padding) #else #undef MP_SIZE #define MP_SIZE 128 - dp_length = SP_INT_DIGITS; + dp_length = Z->size; #endif /* TODO end */ this_extra = Z->used; - if (this_extra > MP_SIZE) { - ESP_LOGW(TAG, "Warning (Z->used: %d) > (MP_SIZE: %d); adjusting...", - Z->used, MP_SIZE); - this_extra = MP_SIZE; + if (this_extra > dp_length) { + ESP_LOGW(TAG, "Warning (Z->used: %d) > (dp_length: %d); adjusting...", + Z->used, dp_length); + this_extra = dp_length; } - while (Z->dp[this_extra] > 0 && (this_extra < MP_SIZE)) { + while ((this_extra < dp_length) && (Z->dp[this_extra] > 0)) { ESP_LOGV(TAG, "Adjust! %d", this_extra); Z->dp[this_extra] = 0; this_extra++; diff --git a/wolfcrypt/src/port/Espressif/esp32_util.c b/wolfcrypt/src/port/Espressif/esp32_util.c index ed258b17e2e..71720a88bae 100644 --- a/wolfcrypt/src/port/Espressif/esp32_util.c +++ b/wolfcrypt/src/port/Espressif/esp32_util.c @@ -467,7 +467,7 @@ static int show_macro(char* s, char* not_defined) #define ESP_SMS_DIS_POS 42 /* save our string (s) into the space-padded message (msg) */ - while (s[i] != '\0' && msg[i] != '\0' && (i < MAX_STATUS_NAME_LENGTH)) { + while ((i < MAX_STATUS_NAME_LENGTH) && s[i] != '\0' && msg[i] != '\0') { msg[i] = s[i]; i++; }