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

Ticket: #6186
pull/11595/head
Philippe Antoine 2 years 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; n = LOG_NODE_STRLEN-2;
np = NULL; /* End */ np = NULL; /* End */
}else{ }else{
n = np-p; n = (uint32_t)(np - p);
} }
strlcpy(node->data,p,n+1); strlcpy(node->data,p,n+1);
p = np; p = np;
@ -151,7 +151,7 @@ int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
np = strchr(p, '}'); np = strchr(p, '}');
if (np != NULL && np-p > 1 && np-p < LOG_NODE_STRLEN-2) { if (np != NULL && np-p > 1 && np-p < LOG_NODE_STRLEN-2) {
p++; p++;
n = np-p; n = (uint32_t)(np - p);
strlcpy(node->data, p, n+1); strlcpy(node->data, p, n+1);
p = np; p = np;
} else { } else {

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

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

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

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

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

@ -41,7 +41,7 @@
void PrintBufferRawLineHex(char *, int *,int, const uint8_t *, uint32_t); void PrintBufferRawLineHex(char *, int *,int, const uint8_t *, uint32_t);
void PrintRawUriFp(FILE *, 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 PrintRawDataFp(FILE *, const uint8_t *, uint32_t);
void PrintRawDataToBuffer(uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32_t dst_buf_size, 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); const uint8_t *src_buf, uint32_t src_buf_len);

Loading…
Cancel
Save