From ef347762e7b7bfe5f8cd2f9e5a9b8c8f84b874a6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 1 Oct 1997 13:58:14 +0000 Subject: Prevent buffer overruns in the MDA command. svn path=/trunk/; revision=1459 --- driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 86622068..3032433e 100644 --- a/driver.c +++ b/driver.c @@ -868,8 +868,13 @@ int num; /* index of message */ strcat(names, idp->id); strcat(names, " "); } - cmd = (char *)alloca(strlen(ctl->mda) + length); + length += strlen(ctl->mda); + cmd = (char *)alloca(length); +#ifdef SNPRINTF + snprintf(cmd, length, ctl->mda, names); +#else sprintf(cmd, ctl->mda, names); +#endif /* SNPRINTF */ if (outlevel == O_VERBOSE) error(0, 0, "about to deliver with: %s", cmd); -- cgit v1.2.3