summaryrefslogtreecommitdiffstats
path: root/server/main.c
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2010-08-20 00:35:21 +0200
committerJeff Trawick <trawick@apache.org>2010-08-20 00:35:21 +0200
commit6526baecedf16e62a5997fa0c6c52ba77b9929f9 (patch)
treea74b80bd58e9a5de73c965e75ce220ca1ae3b677 /server/main.c
parentalert docs readers to minor gotcha (diff)
downloadapache2-6526baecedf16e62a5997fa0c6c52ba77b9929f9.tar.xz
apache2-6526baecedf16e62a5997fa0c6c52ba77b9929f9.zip
Fortify complains about an overflow of pad[], which would
require a mongo argv[0]. Get the vprintf formatter to handle the padding and avoid creating the padding altogether. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@987339 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/main.c')
-rw-r--r--server/main.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/server/main.c b/server/main.c
index 84a8fe6bc0..3bd61d4128 100644
--- a/server/main.c
+++ b/server/main.c
@@ -331,37 +331,32 @@ static process_rec *init_process(int *argc, const char * const * *argv)
static void usage(process_rec *process)
{
const char *bin = process->argv[0];
- char pad[MAX_STRING_LEN];
- unsigned i;
-
- for (i = 0; i < strlen(bin); i++) {
- pad[i] = ' ';
- }
-
- pad[i] = '\0';
+ int pad_len = strlen(bin);
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
"Usage: %s [-D name] [-d directory] [-f file]", bin);
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
- " %s [-C \"directive\"] [-c \"directive\"]", pad);
+ " %*s [-C \"directive\"] [-c \"directive\"]", pad_len, " ");
#ifdef WIN32
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
- " %s [-w] [-k start|restart|stop|shutdown] [-n service_name]", pad);
+ " %*s [-w] [-k start|restart|stop|shutdown] [-n service_name]",
+ pad_len, " ");
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
- " %s [-k install|config|uninstall] [-n service_name]",
- pad);
+ " %*s [-k install|config|uninstall] [-n service_name]",
+ pad_len, " ");
#else
/* XXX not all MPMs support signalling the server in general or graceful-stop
* in particular
*/
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
- " %s [-k start|restart|graceful|graceful-stop|stop]",
- pad);
+ " %*s [-k start|restart|graceful|graceful-stop|stop]",
+ pad_len, " ");
#endif
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
- " %s [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]", pad);
+ " %*s [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]",
+ pad_len, " ");
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
"Options:");