diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-16 11:52:11 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-16 11:52:11 -0400 |
| commit | dc6b871b419159097c272fe21cdef6acece40a99 (patch) | |
| tree | 1d2e4ef745106cb4a7a804698b45739a163cbe38 /src/cli/stasis/args.c | |
| parent | f40adf8259a9f034b6fff7abff047e9a746f7ec1 (diff) | |
| download | stasis-dc6b871b419159097c272fe21cdef6acece40a99.tar.gz | |
Convert more strcat and strcpy to strn variants
Diffstat (limited to 'src/cli/stasis/args.c')
| -rw-r--r-- | src/cli/stasis/args.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cli/stasis/args.c b/src/cli/stasis/args.c index 696f3a6..98b4479 100644 --- a/src/cli/stasis/args.c +++ b/src/cli/stasis/args.c @@ -89,20 +89,20 @@ void usage(char *progname) { char opt_long[50] = {0}; // --? [ARG]? char opt_short[50] = {0}; // -? [ARG]? - strcat(opt_long, "--"); - strcat(opt_long, long_options[x].name); + strncat(opt_long, "--", sizeof(opt_long) - strlen(opt_long) - 1); + strncat(opt_long, long_options[x].name, sizeof(opt_long) - strlen(opt_long) - 1); if (long_options[x].has_arg) { - strcat(opt_long, " ARG"); + strncat(opt_long, " ARG", sizeof(opt_long) - strlen(opt_long) - 1); } if (long_options[x].val <= 'z') { - strcat(opt_short, "-"); + strncat(opt_short, "-", sizeof(opt_short) - strlen(opt_short) - 1); opt_short[1] = (char) long_options[x].val; if (long_options[x].has_arg) { - strcat(opt_short, " ARG"); + strncat(opt_short, " ARG", sizeof(opt_short) - strlen(opt_short) - 1); } } else { - strcat(opt_short, " "); + strncat(opt_short, " ", sizeof(opt_short) - strlen(opt_short) - 1); } const char *opt_fmt = " %%-%ds\t%%s\t\t%%s"; |
