/* libdeps plugin for the GNU linker.
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020-2022 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
arhdr ah;
int len;
unsigned long mlen;
+ size_t amt;
linerec *lr;
enum ld_plugin_status rc = LDPS_NO_SYMS;
lseek (fd, mlen, SEEK_CUR);
continue;
}
- lr = malloc (sizeof (linerec) + mlen);
+ amt = mlen + sizeof (linerec);
+ if (amt <= mlen)
+ return LDPS_ERR;
+ lr = malloc (amt);
if (!lr)
return LDPS_ERR;
lr->next = NULL;
end = in + strlen (in);
s = in;
- while (isspace (*s)) s++;
+ while (isspace ((unsigned char) *s)) s++;
first = s;
i = 1;
memmove (s, s+1, end-s-1);
end--;
}
- if (isspace (*s))
+ if (isspace ((unsigned char) *s))
{
if (sq || dq)
continue;
*s++ = '\0';
- while (isspace (*s)) s++;
+ while (isspace ((unsigned char) *s)) s++;
if (*s)
res[++i] = s;
}