From 4433b3c36c29a4a5201f3c54773068eed1dc44f6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 16 Jun 2018 20:55:42 +0200 Subject: [PATCH] csv: fix detection of column separators --- lib/formats/csv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/formats/csv.c b/lib/formats/csv.c index 57832c0ba..a6f5b7e2f 100644 --- a/lib/formats/csv.c +++ b/lib/formats/csv.c @@ -77,13 +77,13 @@ static size_t csv_sscan_single(struct io *io, const char *buf, size_t len, struc if (end == ptr || *end == io->delimiter) goto out; - ptr = end; + ptr = end + 1; s->ts.origin.tv_nsec = strtoul(ptr, &end, 10); if (end == ptr || *end == io->delimiter) goto out; - ptr = end; + ptr = end + 1; s->flags |= SAMPLE_HAS_ORIGIN; @@ -91,7 +91,7 @@ static size_t csv_sscan_single(struct io *io, const char *buf, size_t len, struc if (end == ptr || *end == io->delimiter) goto out; - ptr = end; + ptr = end + 1; s->sequence = strtoul(ptr, &end, 10); if (end == ptr || *end == io->delimiter) @@ -99,9 +99,10 @@ static size_t csv_sscan_single(struct io *io, const char *buf, size_t len, struc s->flags |= SAMPLE_HAS_SEQUENCE; - for (ptr = end, s->length = 0; - s->length < s->capacity; - ptr = end, s->length++) { + for (ptr = end + 1, s->length = 0; + s->length < s->capacity; + ptr = end + 1, s->length++) { + if (*end == io->delimiter) goto out;