APPS: Prevent ASAN hickup on idempotent strncpy() in opt_progname()
@@ -105,6 +105,7 @@ char *opt_progname(const char *argv0)
/* Find last special character sys:[foo.bar]openssl */
p = opt_path_end(argv0);
q = strrchr(p, '.');
+ if (prog != p)
strncpy(prog, p, sizeof(prog) - 1);
prog[sizeof(prog) - 1] = '\0';
if (q != NULL && q - p < sizeof(prog))
@@ -132,6 +133,7 @@ char *opt_progname(const char *argv0)
const char *p;
p = opt_path_end(argv0);
+ if (prog != p)
strncpy(prog, p, sizeof(prog) - 1);
prog[sizeof(prog) - 1] = '\0';
return prog;
