diff --git a/htp/bstr.c b/htp/bstr.c index b34d3c0b..928e3a10 100644 --- a/htp/bstr.c +++ b/htp/bstr.c @@ -339,7 +339,7 @@ bstr *bstr_to_lowercase(bstr *b) { size_t i = 0; while (i < len) { - data[i] = tolower(data[i]); + data[i] = (uint8_t)tolower(data[i]); i++; } diff --git a/htp/htp_base64.c b/htp/htp_base64.c index 0b03a6f3..db8fef9a 100644 --- a/htp/htp_base64.c +++ b/htp/htp_base64.c @@ -103,7 +103,7 @@ int htp_base64_decode(htp_base64_decoder *decoder, const void *_code_in, int len } fragment = (char) htp_base64_decode_single(*codechar++); } while (fragment < 0); - *plainchar = (fragment & 0x03f) << 2; + *plainchar = (unsigned char) ((fragment & 0x03f) << 2); /* fall through */ case step_b: @@ -116,7 +116,7 @@ int htp_base64_decode(htp_base64_decoder *decoder, const void *_code_in, int len fragment = (char) htp_base64_decode_single(*codechar++); } while (fragment < 0); *plainchar++ |= (fragment & 0x030) >> 4; - *plainchar = (fragment & 0x00f) << 4; + *plainchar = (unsigned char) ((fragment & 0x00f) << 4); if (--length_out == 0) { return plainchar - plaintext_out; } @@ -132,7 +132,7 @@ int htp_base64_decode(htp_base64_decoder *decoder, const void *_code_in, int len fragment = (char) htp_base64_decode_single(*codechar++); } while (fragment < 0); *plainchar++ |= (fragment & 0x03c) >> 2; - *plainchar = (fragment & 0x003) << 6; + *plainchar = (unsigned char) ((fragment & 0x003) << 6); if (--length_out == 0) { return plainchar - plaintext_out; } diff --git a/htp/htp_config.c b/htp/htp_config.c index 41b5cb4c..767458f0 100644 --- a/htp/htp_config.c +++ b/htp/htp_config.c @@ -724,11 +724,11 @@ void htp_config_set_bestfit_map(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, void void htp_config_set_bestfit_replacement_byte(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int b) { if (ctx >= HTP_DECODER_CONTEXTS_MAX) return; - cfg->decoder_cfgs[ctx].bestfit_replacement_byte = b; + cfg->decoder_cfgs[ctx].bestfit_replacement_byte = (unsigned char) b; if (ctx == HTP_DECODER_DEFAULTS) { for (size_t i = 0; i < HTP_DECODER_CONTEXTS_MAX; i++) { - cfg->decoder_cfgs[i].bestfit_replacement_byte = b; + cfg->decoder_cfgs[i].bestfit_replacement_byte = (unsigned char) b; } } } diff --git a/htp/htp_response.c b/htp/htp_response.c index a637c834..dec1222b 100644 --- a/htp/htp_response.c +++ b/htp/htp_response.c @@ -401,7 +401,7 @@ htp_status_t htp_connp_RES_BODY_CHUNKED_LENGTH(htp_connp_t *connp) { // Have we reached the end of the line? Or is this not chunked after all? if (connp->out_next_byte == LF || - (!is_chunked_ctl_char(connp->out_next_byte) && !data_probe_chunk_length(connp))) { + (!is_chunked_ctl_char((unsigned char) connp->out_next_byte) && !data_probe_chunk_length(connp))) { unsigned char *data; size_t len;