Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d72ab8f authored by Chuck Lever's avatar Chuck Lever Committed by J. Bruce Fields
Browse files

NFSD: Stricter buffer size checking in write_recoverydir()



While it's not likely a pathname will be longer than
SIMPLE_TRANSACTION_SIZE, we should be more careful about just
plopping it into the output buffer without bounds checking.

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 017cb47f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1260,8 +1260,9 @@ static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size)

		status = nfs4_reset_recoverydir(recdir);
	}
	sprintf(buf, "%s\n", nfs4_recoverydir());
	return strlen(buf);

	return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%s\n",
							nfs4_recoverydir());
}

/**