Use the size passed to the malloc() here.
Found-with: Coccinelle (http://coccinelle.lip6.fr/)
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $DragonFly: src/sbin/hammer/cmd_mirror.c,v 1.16 2008/11/09 05:22:56 dillon Exp $
*/
#include "hammer.h"
/* needs 2 extra */
tid_bytes = malloc(sizeof(*tid_bytes) * (HIST_COUNT + 2));
- bzero(tid_bytes, sizeof(tid_bytes));
+ bzero(tid_bytes, sizeof(*tid_bytes) * (HIST_COUNT + 2));
if (*repeatp == 0) {
fprintf(stderr, "Prescan to break up bulk transfer");