int flag);
static const char *cf_expand_variables(const char *cf, int *lineno,
CONF_SECTION *outercs,
- char *output, const char *input);
+ char *output, size_t outsize,
+ const char *input);
int cf_log_config = 1;
int cf_log_modules = 1;
size_t name1_len, name2_len = 0;
char *p;
CONF_SECTION *cs;
- char buffer[256];
+ char buffer[1024];
if (!name1) return NULL;
p = cf_expand_variables(parent->item.filename,
&parent->item.lineno,
parent,
- buffer, name2);
+ buffer, sizeof(buffer), name2);
if (!p) {
radlog(L_ERR, "Failed expanding section name");
return NULL;
*/
static const char *cf_expand_variables(const char *cf, int *lineno,
CONF_SECTION *outercs,
- char *output, const char *input)
+ char *output, size_t outsize,
+ const char *input)
{
char *p;
const char *end, *ptr;
*/
*(p++) = *(ptr++);
}
+
+ if ((p - output) > outsize) return NULL;
} /* loop over all of the input string. */
*p = '\0';
*/
value = cf_expand_variables("<internal>",
&lineno,
- cs, buffer, value);
+ cs, buffer, sizeof(buffer),
+ value);
if (!value) {
cf_log_err(cf_sectiontoitem(cs),"Failed expanding variable %s", name);
return -1;
*/
value = cf_expand_variables("?",
&lineno,
- cs, buffer, value);
+ cs, buffer, sizeof(buffer),
+ value);
if (!value) return -1;
}
if (buf2[0] == '$') relative = 0;
- value = cf_expand_variables(filename, lineno, this, buf, buf2);
+ value = cf_expand_variables(filename, lineno, this, buf, sizeof(buf), buf2);
if (!value) return -1;
if (!FR_DIR_IS_RELATIVE(value)) relative = 0;
if ((t3 == T_BARE_WORD) ||
(t3 == T_DOUBLE_QUOTED_STRING)) {
value = cf_expand_variables(filename, lineno, this,
- buf, buf3);
+ buf, sizeof(buf), buf3);
if (!value) return -1;
} else if ((t3 == T_EOL) ||
(t3 == T_HASH)) {