From: Kern Sibbald Date: Wed, 9 Apr 2014 16:56:59 +0000 (+0200) Subject: Fix Bacula bug #2020 overflow in btape -- Andreas Koch X-Git-Tag: Release-7.0.3~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f06c2d1063f5e7cdca1a040f35bc1f4b1de55300;p=bacula%2Fbacula Fix Bacula bug #2020 overflow in btape -- Andreas Koch --- 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"