From fbe08f4473edc493002a255b213e9f72371f6594 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 1 Feb 2019 08:48:53 +0100 Subject: [PATCH] villas_human: fix buffer overflow --- lib/formats/villas_human.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/formats/villas_human.c b/lib/formats/villas_human.c index 4c4fb6b07..b969d1527 100644 --- a/lib/formats/villas_human.c +++ b/lib/formats/villas_human.c @@ -227,7 +227,7 @@ void villas_human_header(struct io *io, const struct sample *smp) fprintf(f, "(sequence)"); if (io->flags & SAMPLE_HAS_DATA) { - for (int i = 0; i < smp->length; i++) { + for (int i = 0; i < MIN(smp->length, vlist_length(smp->signals)); i++) { struct signal *sig = (struct signal *) vlist_at(smp->signals, i); if (sig->name)