forked from github/server
fix gcc build, introduce a hard limit on ini section size
This commit is contained in:
parent
ebbe4fa4ac
commit
75a97c2977
|
@ -721,15 +721,12 @@ void config_set_from(const dictionary *d)
|
||||||
char key[128];
|
char key[128];
|
||||||
const char *sec = iniparser_getsecname(d, s);
|
const char *sec = iniparser_getsecname(d, s);
|
||||||
int k, nkeys = iniparser_getsecnkeys(d, sec);
|
int k, nkeys = iniparser_getsecnkeys(d, sec);
|
||||||
char *akeys[MAXKEYS];
|
const char *keys[MAXKEYS];
|
||||||
char ** keys = akeys;
|
|
||||||
size_t slen = strlen(sec);
|
size_t slen = strlen(sec);
|
||||||
|
assert(nkeys <= MAXKEYS);
|
||||||
assert(slen<sizeof(key));
|
assert(slen<sizeof(key));
|
||||||
memcpy(key, sec, slen);
|
memcpy(key, sec, slen);
|
||||||
key[slen] = '.';
|
key[slen] = '.';
|
||||||
if (nkeys>MAXKEYS) {
|
|
||||||
keys = malloc(sizeof(const char *) * nkeys);
|
|
||||||
}
|
|
||||||
iniparser_getseckeys(d, sec, keys);
|
iniparser_getseckeys(d, sec, keys);
|
||||||
for (k=0;k!=nkeys;++k) {
|
for (k=0;k!=nkeys;++k) {
|
||||||
const char *val;
|
const char *val;
|
||||||
|
@ -741,9 +738,6 @@ void config_set_from(const dictionary *d)
|
||||||
config_set(key, val);
|
config_set(key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keys!=akeys) {
|
|
||||||
free(keys);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue