diff options
author | Tomohiro Kusumi <[email protected]> | 2019-05-01 11:41:12 +0900 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-04-30 19:41:12 -0700 |
commit | f0ce0436aa801a5b281f93a456d394fe141034f7 (patch) | |
tree | c4ecfffe9b4b2915215e2a38fc0eaa9d94df0a62 /module/spl/spl-generic.c | |
parent | 77449a1ab0467a6fc43211a9c19d6f60be52a737 (diff) |
Correct snprintf() size argument
The size argument of snprintf(3) in glibc and snprintf() in Linux
kernel includes trailing \0, as snprintf(3) man page explains it as
"write at most size bytes (including the trailing null byte ('\0'))",
i.e. snprintf() can just take buffer size.
e.g. For snprintf() in module/zfs/zfs_ctldir.c, a buffer size is
MAXPATHLEN, and a caller is passing MAXPATHLEN to snprintf(), so size
should just be `path_len` to do what the caller is trying to do.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Richard Laager <[email protected]>
Signed-off-by: Tomohiro Kusumi <[email protected]>
Closes #8692
Diffstat (limited to 'module/spl/spl-generic.c')
0 files changed, 0 insertions, 0 deletions