From 5bc2ee09e4dff0f872ce738a5327bced915e3474 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 4 Jan 2013 14:46:58 +0100 Subject: [PATCH] ISO2709 decoding: be more picky WRT header --- src/marc_read_iso2709.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/marc_read_iso2709.c b/src/marc_read_iso2709.c index 00fedbb..03bedd7 100644 --- a/src/marc_read_iso2709.c +++ b/src/marc_read_iso2709.c @@ -36,7 +36,11 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize) yaz_marc_reset(mt); - record_length = atoi_n (buf, 5); + if (!atoi_n_check(buf, 5, &record_length)) + { + yaz_marc_cprintf(mt, "Bad leader"); + return -1; + } if (record_length < 25) { yaz_marc_cprintf(mt, "Record length %d < 24", record_length); -- 1.7.10.4