From: Doug Ledford Date: Mon, 11 Jan 2010 20:38:14 +0000 (-0500) Subject: Fix segfault when the AUTO keyword is used in the config file X-Git-Tag: mdadm-3.1.2~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d0b563b5b5597cc1467e3560f87fc3a144223a2;p=thirdparty%2Fmdadm.git Fix segfault when the AUTO keyword is used in the config file Signed-off-by: Doug Ledford Signed-off-by: NeilBrown --- diff --git a/config.c b/config.c index c962afda..07a12dcb 100644 --- a/config.c +++ b/config.c @@ -677,12 +677,21 @@ void homehostline(char *line) static char *auto_options = NULL; void autoline(char *line) { + char *w; + if (auto_options) { fprintf(stderr, Name ": AUTO line may only be give once." " Subsequent lines ignored\n"); return; } - auto_options = line; + + auto_options = dl_strdup(line); + dl_init(auto_options); + + for (w=dl_next(line); w != line ; w=dl_next(w)) { + char *w2 = dl_strdup(w); + dl_add(auto_options, w2); + } } int loaded = 0;