Skip to content

Commit

Permalink
wpapcap2john: Fix handling of obsolete type 2 pcapng packet blocks
Browse files Browse the repository at this point in the history
Untested; fixes #5471
  • Loading branch information
solardiz committed May 16, 2024
1 parent 6376f64 commit 08e2241
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/wpapcap2john.c
Original file line number Diff line number Diff line change
Expand Up @@ -1980,23 +1980,23 @@ static int process_ng(FILE *in)
pcapngpb.len = swap32u(pcapngpb.len);
}

if ((pcapngepb.timestamp_high == 0) &&
(pcapngepb.timestamp_low == 0) && !warn_wpaclean++)
if ((pcapngpb.timestamp_high == 0) &&
(pcapngpb.timestamp_low == 0) && !warn_wpaclean++)
fprintf(stderr,
"**\n** Warning: %s seems to be processed with some dubious tool like\n"
"** 'wpaclean'. Important information may be lost.\n**\n", filename);

MEM_FREE(full_packet);
safe_malloc(full_packet, pcapngepb.caplen);
safe_malloc(full_packet, pcapngpb.caplen);
res = fread(full_packet, 1, pcapngpb.caplen, in);
if (res != pcapngpb.caplen) {
printf("failed to read packet: %s truncated?\n", filename);
break;
}
fseek(in, pcapngbh.total_length - BH_SIZE - PB_SIZE - pcapngepb.caplen, SEEK_CUR);
fseek(in, pcapngbh.total_length - BH_SIZE - PB_SIZE - pcapngpb.caplen, SEEK_CUR);

MEM_FREE(full_packet);
safe_malloc(full_packet, pcapngepb.caplen);
safe_malloc(full_packet, pcapngpb.caplen);
res = fread(full_packet, 1, pcapngpb.caplen, in);
if (res != pcapngpb.caplen) {
printf("failed to read packet: %s truncated?\n", filename);
Expand Down

0 comments on commit 08e2241

Please sign in to comment.