summaryrefslogtreecommitdiffstats
path: root/src/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/format.c b/src/format.c
index f738c44..6138207 100644
--- a/src/format.c
+++ b/src/format.c
@@ -1042,19 +1042,28 @@ static char *
format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
const char *fmt, char ***visited_ndns)
{
- char buf[YPMAXRECORD], *tmp;
+ char *buf, *tmp, *ret;
const char *match, *fmtstart, *fmtend;
- unsigned int i, j;
+ unsigned int i, j, buflen;
int exp_len;
- i = format_expand(state, pb, e, fmt, buf, sizeof(buf),
- visited_ndns, TRUE);
- if (i < sizeof(buf)) {
+ buflen = state->max_value_size;
+ buf = malloc(buflen);
+ if (buf == NULL) {
+ return NULL;
+ }
+
+ i = format_expand(state, pb, e, fmt, buf, buflen, visited_ndns, TRUE);
+ if (i < buflen) {
buf[i] = '\0';
- return strdup(buf);
+ ret = strdup(buf);
} else {
- return NULL;
+ ret = NULL;
}
+
+ free(buf);
+
+ return ret;
}
char *