diff options
author | Adam <Adam@anope.org> | 2013-07-25 20:31:51 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-25 20:31:51 -0400 |
commit | a563c8fb2f3b92de6b3f7a0417f213036f7000e6 (patch) | |
tree | c35ff8b9825365de3d4c098e75578fa42d42b377 /src | |
parent | def6a6deee39d80890d6cabd0a6bb7f28e3c6d7b (diff) |
Fix dumb modules
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 6 | ||||
-rw-r--r-- | src/modules.c | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index bb43e7d81..5436b0663 100644 --- a/src/config.c +++ b/src/config.c @@ -774,7 +774,11 @@ int parse_directive(Directive * d, char *dir, int ac, char *av[MAXPARAMS], *(int *) d->params[i].ptr = val; break; case PARAM_STRING: - Anope_Free(*(char **)d->params[i].ptr); + /* + * Anope_Free(*(char **)d->params[i].ptr); + * Historically dumb modules pass uninitialized values here so + * we can't free this + */ *(char **) d->params[i].ptr = sstrdup(av[optind++]); if (!d->params[i].ptr) { error(linenum, "%s: Out of memory", d->name); diff --git a/src/modules.c b/src/modules.c index f1fcb39d1..ceeb7e3a0 100644 --- a/src/modules.c +++ b/src/modules.c @@ -2563,6 +2563,14 @@ int moduleGetConfigDirective(Directive * d) char *s = NULL; char *t = NULL; int retval = 1; + int i; + + /* Dumb modules pass uninitialized string pointers here. Dumb people will not add the proper configuration values to services.conf. + * Combine the two and you end up with parse_directive never setting the char* pointers passed here. So, null them out now. + */ + for (i = 0; i < MAXPARAMS && d->params[i].type != PARAM_NONE; i++) + if (d->params[i].type == PARAM_STRING) + *(char **) d->params[i].ptr = NULL; config = fopen(SERVICES_CONF, "r"); if (!config) { |