- int no = atoi((const char *)attr->name+1);
- if (attr->children
- && attr->children->type == XML_TEXT_NODE)
- indstr[no] = attr->children->content[0];
+ int no = atoi((const char *)attr->name + 1);
+ if (attr->children &&
+ attr->children->type == XML_TEXT_NODE &&
+ no <= indicator_length && no > 0 &&
+ attr->children->content[0])
+ {
+ indstr[no - 1] = attr->children->content[0];
+ }
+ else
+ {
+ yaz_marc_cprintf(
+ mt, "Bad attribute '%.80s' for 'd'",attr->name);
+ }