X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fctf.c;h=a418a6d507d4f1f33051495bdd3c95ada513f5ae;hp=f57d086efcef1ff235aeb7140388e5be17fb2665;hb=58b0b8835f84f2a028328e02eb5044640880d1e5;hpb=df752f351b1ba0f8cd0b70ba328afa8d36bc31a9 diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index f57d086e..a418a6d5 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -458,9 +458,9 @@ int create_stream_packet_index(struct ctf_trace *td, return -EINVAL; } - if (packet_index.packet_size > filestats.st_size * CHAR_BIT) { - fprintf(stdout, "[error] Packet size (%zu bits) is larger than file size (%zu bits).\n", - packet_index.content_size, filestats.st_size * CHAR_BIT); + if (packet_index.packet_size > (filestats.st_size - packet_index.offset) * CHAR_BIT) { + fprintf(stdout, "[error] Packet size (%zu bits) is larger than remaining file size (%zu bits).\n", + packet_index.content_size, (filestats.st_size - packet_index.offset) * CHAR_BIT); return -EINVAL; }