summaryrefslogtreecommitdiff
path: root/usr.bin/asn1_compile
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/asn1_compile
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.bin/asn1_compile')
-rw-r--r--usr.bin/asn1_compile/gen_copy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/asn1_compile/gen_copy.c b/usr.bin/asn1_compile/gen_copy.c
index bd311addac5..3341822f81a 100644
--- a/usr.bin/asn1_compile/gen_copy.c
+++ b/usr.bin/asn1_compile/gen_copy.c
@@ -108,7 +108,7 @@ copy_type (const char *from, const char *to, const Type *t)
char *T;
fprintf (codefile, "if(((%s)->val = "
- "malloc((%s)->len * sizeof(*(%s)->val))) == NULL && (%s)->len != 0)\n",
+ "calloc((%s)->len, sizeof(*(%s)->val))) == NULL && (%s)->len != 0)\n",
to, from, to, from);
fprintf (codefile, "return ENOMEM;\n");
fprintf(codefile,