Commit bf1e0198 authored by Paras Jain's avatar Paras Jain Committed by Maureen Helm
Browse files

lib: posix: fix out-of-bound write

Ensure that write is in buffer limits

Coverity-CID: 186491

Signed-off-by: default avatarParas Jain <parasjain2000@gmail.com>
parent eb9df85f
Loading
Loading
Loading
Loading
+1 −1
Changes for lib/posix/fs.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ struct dirent *readdir(DIR *dirp)
	}

	rc = strlen(fdirent.name);
	rc = (rc <= PATH_MAX) ? rc : PATH_MAX;
	rc = (rc < PATH_MAX) ? rc : (PATH_MAX - 1);
	memcpy(pdirent.d_name, fdirent.name, rc);

	/* Make sure the name is NULL terminated */