mirror of
https://github.com/anope/anope.git
synced 2026-07-01 08:56:37 +02:00
BUILD : 1.7.14 (1046) BUGS : NOTES : We were walking memory in moduleGetConfigDirecte with an allocated pointer, and free-ing it later when it was past the allocatrd space... We now store the original pointer so we can free it correctly :)
git-svn-id: svn://svn.anope.org/anope/trunk@1046 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@770 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
parent
f1d0119044
commit
d4674e1e67
+9
-7
@@ -2425,6 +2425,7 @@ int moduleGetConfigDirective(Directive * d)
|
||||
int linenum = 0;
|
||||
int ac = 0;
|
||||
char *av[MAXPARAMS];
|
||||
char *str = NULL;
|
||||
char *s = NULL;
|
||||
char *t = NULL;
|
||||
int retval = 1;
|
||||
@@ -2440,17 +2441,18 @@ int moduleGetConfigDirective(Directive * d)
|
||||
continue;
|
||||
dir = myStrGetOnlyToken(buf, '\t', 0);
|
||||
if (dir) {
|
||||
s = myStrGetTokenRemainder(buf, '\t', 1);
|
||||
str = myStrGetTokenRemainder(buf, '\t', 1);
|
||||
} else {
|
||||
dir = myStrGetOnlyToken(buf, ' ', 0);
|
||||
if (dir || (dir = myStrGetOnlyToken(buf, '\n', 0))) {
|
||||
s = myStrGetTokenRemainder(buf, ' ', 1);
|
||||
str = myStrGetTokenRemainder(buf, ' ', 1);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (stricmp(dir, d->name) == 0) {
|
||||
if (s) {
|
||||
if (str) {
|
||||
s = str;
|
||||
while (isspace(*s))
|
||||
s++;
|
||||
while (*s) {
|
||||
@@ -2484,10 +2486,10 @@ int moduleGetConfigDirective(Directive * d)
|
||||
retval = parse_directive(d, dir, ac, av, linenum, 0, s);
|
||||
}
|
||||
}
|
||||
if (dir)
|
||||
free(dir);
|
||||
if (s)
|
||||
free(s);
|
||||
if (dir)
|
||||
free(dir);
|
||||
if (str)
|
||||
free(str);
|
||||
fclose(config);
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user