summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/io.c b/io.c
index 88548980..4addda0a 100644
--- a/io.c
+++ b/io.c
@@ -1225,8 +1225,7 @@ void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
char ***argv_p, int *argc_p, char **request_p)
{
int maxargs = MAX_ARGS;
- int dot_pos = 0;
- int argc = 0;
+ int dot_pos = 0, argc = 0, request_len = 0;
char **argv, *p;
int rl_flags = (rl_nulls ? RL_EOL_NULLS : 0);
@@ -1239,6 +1238,9 @@ void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
if (mod_name && !protect_args)
argv[argc++] = "rsyncd";
+ if (request_p)
+ *request_p = NULL;
+
while (1) {
if (read_line(f_in, buf, bufsiz, rl_flags) == 0)
break;
@@ -1250,9 +1252,14 @@ void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
}
if (dot_pos) {
- if (request_p) {
- *request_p = strdup(buf);
- request_p = NULL;
+ if (request_p && request_len < 1024) {
+ int len = strlen(buf);
+ if (request_len)
+ request_p[0][request_len++] = ' ';
+ if (!(*request_p = realloc_array(*request_p, char, request_len + len + 1)))
+ out_of_memory("read_args");
+ memcpy(*request_p + request_len, buf, len + 1);
+ request_len += len;
}
if (mod_name)
glob_expand_module(mod_name, buf, &argv, &argc, &maxargs);