mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-24 10:59:29 +01:00
nlist: Check whether the nl argument is not NULL
This prevents programming errors. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
parent
2c754f435b
commit
3aaedb1208
@ -72,7 +72,10 @@ The last entry in the list is always
|
|||||||
The number of invalid entries is returned if successful; otherwise,
|
The number of invalid entries is returned if successful; otherwise,
|
||||||
if the file
|
if the file
|
||||||
.Fa filename
|
.Fa filename
|
||||||
does not exist or is not executable, the returned value is \-1.
|
does not exist or is not executable,
|
||||||
|
or the nl pointer is
|
||||||
|
.Dv NULL ,
|
||||||
|
the returned value is \-1.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr elf 5
|
.Xr elf 5
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
|
@ -258,6 +258,10 @@ nlist(const char *name, struct nlist *list)
|
|||||||
{
|
{
|
||||||
int fd, n;
|
int fd, n;
|
||||||
|
|
||||||
|
if (list == NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
fd = open(name, O_RDONLY, 0);
|
fd = open(name, O_RDONLY, 0);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user