aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/getopt32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index cd890323e..913a009b0 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -497,8 +497,9 @@ getopt32(char **argv, const char *applet_opts, ...)
if (argv[1] && argv[1][0] != '-' && argv[1][1] != '\0') {
#if DONT_USE_PRINTF
char *pp = alloca(strlen(argv[1]) + 2);
- *pp++ = '-';
- argv[1] = strcpy(pp, argv[1]);
+ *pp = '-';
+ strcpy(pp + 1, argv[1]);
+ argv[1] = pp;
#else
argv[1] = xasprintf("-%s", argv[1]);
if (ENABLE_FEATURE_CLEAN_UP)