summaryrefslogtreecommitdiff
path: root/libexec/spamlogd/spamlogd.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-08-10 16:06:02 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-08-10 16:06:02 +0000
commit7d04bf8fce3cd95028d7b74d7863130feb233e34 (patch)
tree70a42f8a0bd1d8e2e93f508456f10ae664315c25 /libexec/spamlogd/spamlogd.c
parent6e77eb64256edd2295554153a290f97801fdd949 (diff)
Variable size arrays are not ANSI C. Replace by malloc/free.
ok deraadt@ henning@
Diffstat (limited to 'libexec/spamlogd/spamlogd.c')
-rw-r--r--libexec/spamlogd/spamlogd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libexec/spamlogd/spamlogd.c b/libexec/spamlogd/spamlogd.c
index f1ed25cdaf6..0f9e5f7aab2 100644
--- a/libexec/spamlogd/spamlogd.c
+++ b/libexec/spamlogd/spamlogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamlogd.c,v 1.8 2004/07/14 21:22:18 jmc Exp $ */
+/* $OpenBSD: spamlogd.c,v 1.9 2004/08/10 16:06:01 otto Exp $ */
/*
* Copyright (c) 2004 Bob Beck. All rights reserved.
@@ -190,7 +190,12 @@ main(int argc, char **argv)
lbuf = NULL;
while ((buf = fgetln(f, &len))) {
char *cp = NULL;
- char buf2[len + 1];
+ char *buf2;
+
+ if ((buf2 = malloc(len + 1)) == NULL) {
+ syslog_r(LOG_ERR, &sdata, "malloc failed");
+ exit(1);
+ }
if (buf[len - 1] == '\n')
buf[len - 1] = '\0';
@@ -248,6 +253,7 @@ main(int argc, char **argv)
free(lbuf);
lbuf = NULL;
+ free(buf2);
}
exit(0);
}