parse: get rid of raw option offsets
[fio.git] / options.c
index 29b181a020ac5a62cdfd7b6eaed3fc6db133ab17..5ee70befced30f6729f6684b725d5493c9ca22ae 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3786,7 +3786,13 @@ int add_option(struct fio_option *o)
                __o++;
        }
 
                __o++;
        }
 
+       if (opt_index + 1 == FIO_MAX_OPTS) {
+               log_err("fio: FIO_MAX_OPTS is too small\n");
+               return 1;
+       }
+
        memcpy(&fio_options[opt_index], o, sizeof(*o));
        memcpy(&fio_options[opt_index], o, sizeof(*o));
+       fio_options[opt_index + 1].name = NULL;
        return 0;
 }
 
        return 0;
 }