Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/cdrom/macppc_installboot Use calloc instead of mallo...
details: https://anonhg.NetBSD.org/src/rev/d8ad159327b9
branches: trunk
changeset: 328133:d8ad159327b9
user: apb <apb%NetBSD.org@localhost>
date: Thu Mar 27 16:34:37 2014 +0000
description:
Use calloc instead of malloc + memset. This fixes a bug
in which the wrong size was passed to memset.
diffstat:
distrib/cdrom/macppc_installboot/installboot.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diffs (23 lines):
diff -r fbb497ce4c05 -r d8ad159327b9 distrib/cdrom/macppc_installboot/installboot.c
--- a/distrib/cdrom/macppc_installboot/installboot.c Thu Mar 27 16:26:22 2014 +0000
+++ b/distrib/cdrom/macppc_installboot/installboot.c Thu Mar 27 16:34:37 2014 +0000
@@ -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 @@
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)
Home |
Main Index |
Thread Index |
Old Index