Skip to content

Commit 6a0fcbc

Browse files
authored
Merge pull request #213 from suve/ensure-VERSION-is-NUL-terminated
Ensure VERSION is NUL-terminated
2 parents 2da4dc4 + 7bb2fef commit 6a0fcbc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dumb-init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void handle_signal(int signum) {
126126

127127
void print_help(char *argv[]) {
128128
fprintf(stderr,
129-
"dumb-init v%s"
129+
"dumb-init v%*s"
130130
"Usage: %s [option] command [[arg] ...]\n"
131131
"\n"
132132
"dumb-init is a simple process supervisor that forwards signals to children.\n"
@@ -144,7 +144,7 @@ void print_help(char *argv[]) {
144144
" -V, --version Print the current version and exit.\n"
145145
"\n"
146146
"Full help is available online at https://github.com/Yelp/dumb-init\n",
147-
VERSION,
147+
VERSION_len, VERSION,
148148
argv[0]
149149
);
150150
}
@@ -199,7 +199,7 @@ char **parse_command(int argc, char *argv[]) {
199199
debug = 1;
200200
break;
201201
case 'V':
202-
fprintf(stderr, "dumb-init v%s", VERSION);
202+
fprintf(stderr, "dumb-init v%*s", VERSION_len, VERSION);
203203
exit(0);
204204
case 'c':
205205
use_setsid = 0;

0 commit comments

Comments
 (0)