Skip to content

Commit

Permalink
Add another dataBlock test
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed May 6, 2024
1 parent 43fd78d commit d105409
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/netflow/netflow_v9.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,8 @@ static inline void Process_v9_data(exporterDomain_t *exporter, void *data_flowse
break;
}

dbg_printf(
"New record added with %u elements and size: %u, sequencer inLength: %lu, outLength: "
"%lu\n",
recordHeaderV3->numElements, recordHeaderV3->size, sequencer->inLength, sequencer->outLength);
dbg_printf("New record added with %u elements and size: %u, sequencer inLength: %lu, outLength: %lu\n", recordHeaderV3->numElements,
recordHeaderV3->size, sequencer->inLength, sequencer->outLength);

// add router IP
if (fs->sa_family == PF_INET6) {
Expand Down
9 changes: 8 additions & 1 deletion src/nfdump/nfdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
Expand Down Expand Up @@ -324,7 +325,13 @@ static stat_record_t process_data(void *engine, int processwMode, char *wfile, R
for (int i = 0; i < dataBlock_r->NumRecords && !done; i++) {
record_header_t *process_ptr = record_ptr;
if ((sumSize + record_ptr->size) > dataBlock_r->size || (record_ptr->size < sizeof(record_header_t))) {
LogError("Corrupt data file. Inconsistent block size in %s line %d\n", __FILE__, __LINE__);
if (sumSize == dataBlock_r->size) {
LogError("DataBlock count error");
LogError("DataBlock: count: %u, size: %u. Found: %u, size: %u", dataBlock_r->NumRecords, dataBlock_r->size, i, sumSize);
break;
}
LogError("Corrupt data file. Inconsistent block size in %s line %d", __FILE__, __LINE__);
LogError("DataBlock: count: %u, size: %u. Found: %u, size: %u", dataBlock_r->NumRecords, dataBlock_r->size, i, sumSize);
exit(EXIT_FAILURE);
}
sumSize += record_ptr->size;
Expand Down

0 comments on commit d105409

Please sign in to comment.