From: Adam Dickmeiss Date: Thu, 17 Sep 2009 11:27:05 +0000 (+0200) Subject: Skip zero-length subfields for ISO2709. X-Git-Tag: v3.0.49~11^2~2 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=9d01070e0ac3b559b13c76e1cd0f1b0ef17f03c0;p=yaz-moved-to-github.git 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. --- 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