summaryrefslogtreecommitdiff
path: root/usr.bin/midiplay
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
commit6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch)
treebb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.bin/midiplay
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.bin/midiplay')
-rw-r--r--usr.bin/midiplay/midiplay.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/midiplay/midiplay.c b/usr.bin/midiplay/midiplay.c
index d6498c62d1e..ba41a7591eb 100644
--- a/usr.bin/midiplay/midiplay.c
+++ b/usr.bin/midiplay/midiplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: midiplay.c,v 1.8 2005/11/06 00:56:51 jsg Exp $ */
+/* $OpenBSD: midiplay.c,v 1.9 2007/09/02 15:19:33 deraadt Exp $ */
/* $NetBSD: midiplay.c,v 1.8 1998/11/25 22:17:07 augustss Exp $ */
/*
@@ -321,7 +321,7 @@ playdata(u_char *buf, u_int tot, char *name)
}
if (ntrks == 0)
return;
- tracks = malloc(ntrks * sizeof(struct track));
+ tracks = calloc(ntrks, sizeof(struct track));
if (tracks == NULL)
err(1, "malloc() tracks failed");
for (t = 0; t < ntrks; ) {