log: fix -Wshorten-64-to-32 warnings

Ticket: #6186
pull/11595/head
Philippe Antoine 7 months ago committed by Victor Julien
parent 87eb4b5077
commit 4ae5799720

@ -123,7 +123,7 @@ int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
n = LOG_NODE_STRLEN-2;
np = NULL; /* End */
}else{
n = np-p;
n = (uint32_t)(np - p);
}
strlcpy(node->data,p,n+1);
p = np;
@ -151,7 +151,7 @@ int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
np = strchr(p, '}');
if (np != NULL && np-p > 1 && np-p < LOG_NODE_STRLEN-2) {
p++;
n = np-p;
n = (uint32_t)(np - p);
strlcpy(node->data, p, n+1);
p = np;
} else {

@ -130,7 +130,7 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const SCTime_t
{
LogHttpFileCtx *httplog_ctx = aft->httplog_ctx;
uint32_t i;
uint32_t datalen;
size_t datalen;
char buf[128];
uint8_t *cvalue = NULL;
@ -251,9 +251,9 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const SCTime_t
if (tx->request_headers != NULL) {
h_request_hdr = htp_table_get_c(tx->request_headers, "Cookie");
if (h_request_hdr != NULL) {
cvalue_len = GetCookieValue((uint8_t *) bstr_ptr(h_request_hdr->value),
bstr_len(h_request_hdr->value), (char *) node->data,
&cvalue);
cvalue_len = GetCookieValue((uint8_t *)bstr_ptr(h_request_hdr->value),
(uint32_t)bstr_len(h_request_hdr->value), (char *)node->data,
&cvalue);
}
}
if (cvalue_len > 0 && cvalue != NULL) {

@ -1466,7 +1466,7 @@ static OutputInitResult PcapLogInitCtx(ConfNode *conf)
} else {
lvl = 0;
}
comp->lz4f_prefs.compressionLevel = lvl;
comp->lz4f_prefs.compressionLevel = (int)lvl;
/* Allocate resources for lz4. */

@ -91,9 +91,8 @@ typedef struct LogTlsLogThread_ {
MemBuffer *buffer;
} LogTlsLogThread;
int TLSGetIPInformations(const Packet *p, char* srcip, size_t srcip_len,
Port* sp, char* dstip, size_t dstip_len, Port* dp,
int ipproto)
int TLSGetIPInformations(const Packet *p, char *srcip, socklen_t srcip_len, Port *sp, char *dstip,
socklen_t dstip_len, Port *dp, int ipproto)
{
if ((PKT_IS_TOSERVER(p))) {
switch (ipproto) {

@ -27,8 +27,7 @@
void LogTlsLogRegister(void);
int TLSGetIPInformations(const Packet *p, char* srcip, size_t srcip_len,
Port* sp, char* dstip, size_t dstip_len,
Port* dp, int ipproto);
int TLSGetIPInformations(const Packet *p, char *srcip, socklen_t srcip_len, Port *sp, char *dstip,
socklen_t dstip_len, Port *dp, int ipproto);
#endif /* SURICATA_LOG_TLSLOG_H */

@ -90,10 +90,9 @@ void PrintRawUriFp(FILE *fp, uint8_t *buf, uint32_t buflen)
fprintf(fp, "%s", nbuf);
}
void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen,
uint8_t *buf, uint32_t buflen)
void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen, uint8_t *buf, size_t buflen)
{
for (uint32_t u = 0; u < buflen; u++) {
for (size_t u = 0; u < buflen; u++) {
if (isprint(buf[u]) && buf[u] != '\"') {
if (buf[u] == '\\') {
PrintBufferData(retbuf, offset, retbuflen,

@ -41,7 +41,7 @@
void PrintBufferRawLineHex(char *, int *,int, const uint8_t *, uint32_t);
void PrintRawUriFp(FILE *, uint8_t *, uint32_t);
void PrintRawUriBuf(char *, uint32_t *, uint32_t, uint8_t *, uint32_t);
void PrintRawUriBuf(char *, uint32_t *, uint32_t, uint8_t *, size_t);
void PrintRawDataFp(FILE *, const uint8_t *, uint32_t);
void PrintRawDataToBuffer(uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32_t dst_buf_size,
const uint8_t *src_buf, uint32_t src_buf_len);

Loading…
Cancel
Save