unsigned int flags;
/* Extract key length. */
- if (bfd_libdata (abfd)->ver == LBR_MAJORID)
+ if (bfd_libdata (abfd)->ver == LBR_MAJORID
+ && offsetof (struct vms_idx, keyname) <= (size_t) (endp - p))
{
struct vms_idx *ridx = (struct vms_idx *)p;
flags = 0;
keyname = ridx->keyname;
}
- else if (bfd_libdata (abfd)->ver == LBR_ELFMAJORID)
+ else if (bfd_libdata (abfd)->ver == LBR_ELFMAJORID
+ && offsetof (struct vms_elfidx, keyname) <= (size_t) (endp - p))
{
struct vms_elfidx *ridx = (struct vms_elfidx *)p;
break;
}
bfd_set_filename (res, newname);
+ free (newname);
+ if (bfd_get_filename (res) == NULL)
+ {
+ bfd_close (res);
+ return NULL;
+ }
tdata->cache[modidx] = res;
_bfd_vms_lib_get_imagelib_file (bfd *el)
{
bfd *archive = el->my_archive;
- const char *modname = el->filename;
+ const char *modname = bfd_get_filename (el);
int modlen = strlen (modname);
char *filename;
int j;
{
/* xgettext:c-format */
_bfd_error_handler(_("could not open shared image '%s' from '%s'"),
- filename, archive->filename);
+ filename, bfd_get_filename (archive));
bfd_release (archive, filename);
return NULL;
}
{
if (storage > syms_max)
{
- if (syms_max > 0)
- free (syms);
+ free (syms);
syms_max = storage;
syms = (asymbol **) bfd_malloc (syms_max);
if (syms == NULL)
return TRUE;
error_return:
- if (syms_max > 0)
- free (syms);
- if (map != NULL)
- free (map);
+ free (syms);
+ free (map);
return FALSE;
}
unsigned int nl;
modules[i].abfd = current;
- modules[i].name = vms_get_module_name (current->filename, FALSE);
+ modules[i].name = vms_get_module_name (bfd_get_filename (current), FALSE);
modules[i].ref = 1;
/* FIXME: silently truncate long names ? */