From 916f1d318a4742bacdfb62e2c8861eb3c3630530 Mon Sep 17 00:00:00 2001 From: yhji Date: Wed, 12 Dec 2018 10:31:24 +0900 Subject: [PATCH] Fix memory issue in config2help - issue#103 - https://github.com/landley/toybox/issues/103 - heap-use-after-free - Change to find double dash (CP_PRESERVE) --- scripts/config2help.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config2help.c b/scripts/config2help.c index be53547db..986f1bae7 100644 --- a/scripts/config2help.c +++ b/scripts/config2help.c @@ -192,7 +192,7 @@ char **grab_dashlines(struct double_list **help, struct double_list **from, // Find start of dash block. Must be at start or after blank line. for (;;) { s = skip_spaces((*from)->data); - if (*s == '-' && s[1] != '-' && !count) break; + if (*s == '-' && s[1] != '-' && s[2] != '-' && !count) break; if (!*s) count = 0; else count++;