Module Name: src Committed By: apb Date: Thu Mar 27 16:34:37 UTC 2014
Modified Files: src/distrib/cdrom/macppc_installboot: installboot.c Log Message: Use calloc instead of malloc + memset. This fixes a bug in which the wrong size was passed to memset. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/cdrom/macppc_installboot/installboot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/cdrom/macppc_installboot/installboot.c diff -u src/distrib/cdrom/macppc_installboot/installboot.c:1.4 src/distrib/cdrom/macppc_installboot/installboot.c:1.5 --- src/distrib/cdrom/macppc_installboot/installboot.c:1.4 Wed Mar 25 15:26:49 2009 +++ src/distrib/cdrom/macppc_installboot/installboot.c Thu Mar 27 16:34:37 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.c,v 1.4 2009/03/25 15:26:49 tsutsui Exp $ */ +/* $NetBSD: installboot.c,v 1.5 2014/03/27 16:34:37 apb Exp $ */ /*- * Copyright (c) 2005 Izumi Tsutsui. All rights reserved. @@ -118,12 +118,11 @@ main(int argc, char **argv) params->stage2 = argv[3]; - bb = malloc(MACPPC_BOOT_BLOCK_MAX_SIZE); + bb = calloc(1, MACPPC_BOOT_BLOCK_MAX_SIZE); if (bb == NULL) err(1, "Allocating %ul bytes for bbinfo", MACPPC_BOOT_BLOCK_MAX_SIZE); - memset(bb, 0, sizeof(bb)); rv = read(params->s1fd, bb, params->s1stat.st_size); if (rv == -1)