Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnint 64to32 6186 v20.1 #11367

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/userguide/output/eve/eve-json-output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Metadata::
#payload: yes # enable dumping payload in Base64
#payload-buffer-size: 4kb # max size of payload buffer to output in eve-log
#payload-printable: yes # enable dumping payload in printable (lossy) format
#payload-length: yes # enable dumping payload length
#payload-length: yes # enable dumping payload length, including the gaps
#packet: yes # enable dumping of packet (without stream segments)
#http-body: yes # Requires metadata; enable dumping of http body in Base64
#http-body-printable: yes # Requires metadata; enable dumping of http body in printable format
Expand Down
2 changes: 1 addition & 1 deletion doc/userguide/partials/eve-log.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ outputs:
# payload: yes # enable dumping payload in Base64
# payload-buffer-size: 4kb # max size of payload buffer to output in eve-log
# payload-printable: yes # enable dumping payload in printable (lossy) format
# payload-length: yes # enable dumping payload length
# payload-length: yes # enable dumping payload length, including the gaps
# packet: yes # enable dumping of packet (without stream segments)
# http-body: yes # Requires metadata; enable dumping of http body in Base64
# http-body-printable: yes # Requires metadata; enable dumping of http body in printable format
Expand Down
8 changes: 4 additions & 4 deletions src/counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,9 @@ static uint32_t CountersIdHashFunc(HashTable *ht, void *data, uint16_t datalen)
{
CountersIdType *t = (CountersIdType *)data;
uint32_t hash = 0;
int len = strlen(t->string);
size_t len = strlen(t->string);

for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
hash += u8_tolower((unsigned char)t->string[i]);

hash = hash % ht->array_size;
Expand All @@ -1054,8 +1054,8 @@ static char CountersIdHashCompareFunc(void *data1, uint16_t datalen1,
{
CountersIdType *t1 = (CountersIdType *)data1;
CountersIdType *t2 = (CountersIdType *)data2;
int len1 = 0;
int len2 = 0;
size_t len1 = 0;
size_t len2 = 0;

if (t1 == NULL || t2 == NULL)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/decode-teredo.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,

if (len == IPV6_HEADER_LEN +
IPV6_GET_RAW_PLEN(thdr) + (start - pkt)) {
int blen = len - (start - pkt);
uint32_t blen = len - (uint32_t)(start - pkt);
/* spawn off tunnel packet */
Packet *tp = PacketTunnelPktSetup(tv, dtv, p, start, blen,
DECODE_TUNNEL_IPV6_TEREDO);
Expand Down
4 changes: 2 additions & 2 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ inline int PacketCopyDataOffset(Packet *p, uint32_t offset, const uint8_t *data,
*/
inline int PacketCopyData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
{
SET_PKT_LEN(p, (size_t)pktlen);
SET_PKT_LEN(p, pktlen);
return PacketCopyDataOffset(p, 0, pktdata, pktlen);
}

Expand Down Expand Up @@ -810,7 +810,7 @@ void DecodeThreadVarsFree(ThreadVars *tv, DecodeThreadVars *dtv)
*/
inline int PacketSetData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
{
SET_PKT_LEN(p, (size_t)pktlen);
SET_PKT_LEN(p, pktlen);
if (unlikely(!pktdata)) {
return -1;
}
Expand Down
8 changes: 4 additions & 4 deletions src/feature.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ static uint32_t FeatureHashFunc(HashListTable *ht, void *data,
{
FeatureEntryType *f = (FeatureEntryType *)data;
uint32_t hash = 0;
int len = strlen(f->feature);
size_t len = strlen(f->feature);

for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
hash += u8_tolower((unsigned char)f->feature[i]);

return (hash % ht->array_size);
Expand All @@ -55,8 +55,8 @@ static char FeatureHashCompareFunc(void *data1, uint16_t datalen1,
{
FeatureEntryType *f1 = (FeatureEntryType *)data1;
FeatureEntryType *f2 = (FeatureEntryType *)data2;
int len1 = 0;
int len2 = 0;
size_t len1 = 0;
size_t len2 = 0;

if (f1 == NULL || f2 == NULL)
return 0;
Expand Down
5 changes: 3 additions & 2 deletions src/flow-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static uint32_t FlowTimeoutHash(FlowManagerTimeoutThread *td, SCTime_t ts, const
#define TYPE uint32_t
#endif

const uint32_t ts_secs = SCTIME_SECS(ts);
const time_t ts_secs = SCTIME_SECS(ts);
for (uint32_t idx = hash_min; idx < hash_max; idx+=BITS) {
TYPE check_bits = 0;
const uint32_t check = MIN(BITS, (hash_max - idx));
Expand Down Expand Up @@ -947,7 +947,8 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
gettimeofday(&cond_tv, NULL);
struct timeval add_tv;
add_tv.tv_sec = 0;
add_tv.tv_usec = (sleep_per_wu * 1000);
DEBUG_VALIDATE_BUG_ON(sleep_per_wu > UINT32_MAX / 1000);
add_tv.tv_usec = (uint32_t)(sleep_per_wu * 1000);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be ?

 add_tv.tv_sec = sleep_per_wu / 1000;
 add_tv.tv_usec = (sleep_per_wu % 1000) * 1000;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably yeah

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok in next version

timeradd(&cond_tv, &add_tv, &cond_tv);

struct timespec cond_time = FROM_TIMEVAL(cond_tv);
Expand Down
7 changes: 4 additions & 3 deletions src/output-json-alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ static void AlertAddAppLayer(const Packet *p, JsonBuilder *jb,
const AppProto proto = FlowGetAppProtocol(p->flow);
EveJsonSimpleAppLayerLogger *al = SCEveJsonSimpleGetLogger(proto);
JsonBuilderMark mark = { 0, 0, 0 };
void *state;
if (al && al->LogTx) {
void *state = FlowGetAppState(p->flow);
state = FlowGetAppState(p->flow);
if (state) {
void *tx = AppLayerParserGetTx(p->flow->proto, proto, state, tx_id);
if (tx) {
Expand Down Expand Up @@ -386,11 +387,11 @@ static void AlertAddAppLayer(const Packet *p, JsonBuilder *jb,
}
break;
case ALPROTO_DCERPC:
jb_get_mark(jb, &mark);
void *state = FlowGetAppState(p->flow);
state = FlowGetAppState(p->flow);
if (state) {
void *tx = AppLayerParserGetTx(p->flow->proto, proto, state, tx_id);
if (tx) {
jb_get_mark(jb, &mark);
jb_open_object(jb, "dcerpc");
if (p->proto == IPPROTO_TCP) {
if (!rs_dcerpc_log_json_record_tcp(state, tx, jb)) {
Expand Down
2 changes: 1 addition & 1 deletion suricata.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ outputs:
# payload: yes # enable dumping payload in Base64
# payload-buffer-size: 4kb # max size of payload buffer to output in eve-log
# payload-printable: yes # enable dumping payload in printable (lossy) format
# payload-length: yes # enable dumping payload length
# payload-length: yes # enable dumping payload length, including the gaps
# packet: yes # enable dumping of packet (without stream segments)
# metadata: no # enable inclusion of app layer metadata with alert. Default yes
# http-body: yes # Requires metadata; enable dumping of HTTP body in Base64
Expand Down
Loading