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: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
This commit is contained in:
parent
017cb47f46
commit
3d72ab8fdd
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue