From: Adam Dickmeiss Date: Fri, 31 Mar 1995 10:42:41 +0000 (+0000) Subject: Bug fix. X-Git-Url: http://jsfdemo.indexdata.com/?a=commitdiff_plain;h=8f7f70a49e5db227f9315edabd446b4eeff121ce;p=egate.git Bug fix. --- diff --git a/util/iso2709.c b/util/iso2709.c index 54c32cd..d79e422 100644 --- a/util/iso2709.c +++ b/util/iso2709.c @@ -4,7 +4,10 @@ * Europagate, 1994-1995. * * $Log: iso2709.c,v $ - * Revision 1.14 1995/03/30 14:22:18 adam + * Revision 1.15 1995/03/31 10:42:41 adam + * Bug fix. + * + * Revision 1.14 1995/03/30 14:22:18 adam * More work on new MARC anchor functions. * * Revision 1.13 1995/03/30 07:33:32 adam @@ -171,6 +174,7 @@ Iso2709Rec iso2709_cvt (const char *buf) } (*dpp)->next = NULL; (*dpp)->fields = NULL; + (*dpp)->indicator = NULL; strncpyx ((*dpp)->tag, buf+pos, 3); pos += 3; (*dpp)->length = atoin (buf+pos, p->length_data_entry); @@ -194,6 +198,11 @@ Iso2709Rec iso2709_cvt (const char *buf) int dpos = pos+dp->offset; int epos = pos+dp->offset+dp->length-1; + if (epos <= dpos) + { + iso2709_rm (p); + return NULL; + } fpp = &dp->fields; if (!(*fpp = malloc (sizeof(**fpp)))) @@ -256,7 +265,7 @@ Iso2709Rec iso2709_cvt (const char *buf) strncpyx ((*fpp)->data, buf+dpos, dpos_n - dpos); dpos = dpos_n; - if (dpos == epos) + if (dpos >= epos) { if (buf[dpos] != ISO2709_FS && buf[dpos] != ISO2709_RS) fprintf (stderr, "Missing separator at end of field "