diff options
author | Francis Laniel <[email protected]> | 2020-11-15 18:08:05 +0100 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2020-11-16 08:08:54 -0800 |
commit | 9ca718743ad8402958637bfc196d7b62371a1b9f (patch) | |
tree | 89d5f226138c49fdd1bfd2116b28b2b469357280 /include/linux/genl_magic_struct.h | |
parent | 8eeb99bc81bc1cb3d5e5323d9a82d8392e3a27b4 (diff) |
Modify return value of nla_strlcpy to match that of strscpy.
nla_strlcpy now returns -E2BIG if src was truncated when written to dst.
It also returns this error value if dstsize is 0 or higher than INT_MAX.
For example, if src is "foo\0" and dst is 3 bytes long, the result will be:
1. "foG" after memcpy (G means garbage).
2. "fo\0" after memset.
3. -E2BIG is returned because src was not completely written into dst.
The callers of nla_strlcpy were modified to take into account this modification.
Signed-off-by: Francis Laniel <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'include/linux/genl_magic_struct.h')
0 files changed, 0 insertions, 0 deletions