From d75858100c3aecd27504db3e0ff1cdfe65651999 Mon Sep 17 00:00:00 2001 From: Steffen Nurpmeso Date: Sat, 18 Jan 2020 21:01:01 +0100 Subject: [PATCH] syslogd: cfopts(): reinit strtok() so both OPT1,OPT2 are found Signed-off-by: Steffen Nurpmeso Signed-off-by: Joachim Nilsson --- src/syslogd.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/syslogd.c b/src/syslogd.c index a217b2d..080d9df 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -2335,7 +2335,7 @@ static int cfopt(char **ptr, const char *opt) */ static void cfopts(char *ptr, struct filed *f) { - char *opt; + char *opt, *origptr; /* First locate any whitespace between action and option */ ptr = strpbrk(ptr, "\t ;"); @@ -2346,11 +2346,17 @@ static void cfopts(char *ptr, struct filed *f) if (*ptr != ';') *ptr++ = 0; - opt = strtok(ptr, ";"); - if (!opt) + origptr = ptr; + ptr = strtok(ptr, ";"); + if (!ptr) return; - while (opt) { + for (;;) { + opt = strtok(ptr, ","); + if (!opt) + break; + ptr = NULL; + if (cfopt(&opt, "RFC5424")) { f->f_flags |= RFC5424; f->f_flags &= ~RFC3164; @@ -2360,9 +2366,7 @@ static void cfopts(char *ptr, struct filed *f) } else if (cfopt(&opt, "rotate=")) cfrot(opt, f); else - cfrot(ptr, f); /* Compat v1.6 syntax */ - - opt = strtok(NULL, ","); + cfrot(origptr, f); /* Compat v1.6 syntax */ } }