mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
Prevent uafs_readdir/closedir segfault
Check for the NULL case in uafs_readdir/closedir, so we don't blindly dereference the given pointer. Change-Id: Iaefce9bf2e5135a60e9739f866a1f27333f06e28 Reviewed-on: http://gerrit.openafs.org/1715 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
50f248d160
commit
f7b1923642
@ -3958,6 +3958,11 @@ uafs_readdir_r(usr_DIR * dirp)
|
||||
struct usr_dirent *direntP;
|
||||
struct min_direct *directP;
|
||||
|
||||
if (!dirp) {
|
||||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure this is an open file
|
||||
*/
|
||||
@ -4045,6 +4050,11 @@ uafs_closedir_r(usr_DIR * dirp)
|
||||
int fd;
|
||||
int rc;
|
||||
|
||||
if (!dirp) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = dirp->dd_fd;
|
||||
afs_osi_Free((char *)dirp,
|
||||
sizeof(usr_DIR) + USR_DIRSIZE + sizeof(struct usr_dirent));
|
||||
|
Loading…
Reference in New Issue
Block a user