[Toybox] [PATCH 2] Fix segfault in config2help
Patrick Oppenlander
patrick.oppenlander at gmail.com
Wed Sep 20 22:52:29 PDT 2017
For some reason config2help started segfaulting on me.
I haven't had time to completely track down the reason for this, but it seems that under some conditions sym->help is left dangling after memory is free'd by:
// Append trailing lines.
while (tfrom) dlist_add(&anchor, dlist_zap(&tfrom));
Either way, testing sym->enabled appears to fix the problem.
============8<===============
commit 6c892548ad623ffe2b026139d7f22efb7763f024 (HEAD -> master)
Author: Patrick Oppenlander <patrick.oppenlander at gmail.com>
Date: Thu Sep 21 15:37:42 2017 +1000
fix segfault in config2help
Somehow sym->help can be left non-null after trailing lines are appended.
Fix by not attempting to print help for disabled symbols.
diff --git a/scripts/config2help.c b/scripts/config2help.c
index d238939..cdb250d 100644
--- a/scripts/config2help.c
+++ b/scripts/config2help.c
@@ -397,7 +397,7 @@ int main(int argc, char *argv[])
while (sym) {
struct double_list *dd;
- if (sym->help) {
+ if (sym->help && sym->enabled) {
int i;
char *s = xstrdup(sym->name);
More information about the Toybox
mailing list