Optimize the code that copies strings
[fio.git] / options.c
index f4c9bedf377fe0805c787f1bf349e5b91ce0b7e2..447f231e71485268d7c6bcc5149edf5800e60aaa 100644 (file)
--- a/options.c
+++ b/options.c
@@ -4902,8 +4902,7 @@ char *fio_option_dup_subs(const char *opt)
                return NULL;
        }
 
-       in[OPT_LEN_MAX] = '\0';
-       strncpy(in, opt, OPT_LEN_MAX);
+       snprintf(in, sizeof(in), "%s", opt);
 
        while (*inptr && nchr > 0) {
                if (inptr[0] == '$' && inptr[1] == '{') {