From f06c2d1063f5e7cdca1a040f35bc1f4b1de55300 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 9 Apr 2014 18:56:59 +0200 Subject: [PATCH] Fix Bacula bug #2020 overflow in btape -- Andreas Koch --- bacula/src/stored/btape.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 4082de27d9..2b49fb99a3 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -1117,8 +1117,9 @@ static bool write_two_files() /* * Set big max_file_size so that write_record_to_block * doesn't insert any additional EOF marks + * Do calculation in 64 bits to avoid overflow. */ - dev->max_file_size = 2 * num_recs * dev->max_block_size; + dev->max_file_size = (uint64_t)2 * (uint64_t)num_recs * (uint64_t)dev->max_block_size; Pmsg2(-1, _("\n=== Write, rewind, and re-read test ===\n\n" "I'm going to write %d records and an EOF\n" "then write %d records and an EOF, then rewind,\n" -- 2.39.5