From 9d01070e0ac3b559b13c76e1cd0f1b0ef17f03c0 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 17 Sep 2009 13:27:05 +0200 Subject: [PATCH] Skip zero-length subfields for ISO2709. Skip zero-length subfields when decoding ISO2709. This rare case happens if a record has two FS characters in a sequence. Without this patch there would be a reference beyond char array in using_code_len fragments in marcdisp.c. --- src/marc_read_iso2709.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/marc_read_iso2709.c b/src/marc_read_iso2709.c index 07cd59a..54d8653 100644 --- a/src/marc_read_iso2709.c +++ b/src/marc_read_iso2709.c @@ -177,7 +177,8 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize) buf[i] != ISO2709_RS && buf[i] != ISO2709_IDFS && buf[i] != ISO2709_FS) i++; - yaz_marc_add_subfield(mt, buf+code_offset, i - code_offset); + if (i > code_offset) + yaz_marc_add_subfield(mt, buf+code_offset, i - code_offset); } } else -- 1.7.10.4