vfs: introduce helper function to safely NUL-terminate symlinks
PATCH v4 1/1 vfs: introduce helper function to safely NUL-terminate symlinks
A number of filesystems were potentially triggering kernel bugs due to corrupted symlink names on disk. This helper helps safely terminate the names.
Cc Al Viro <[email protected]>
Cc Andrew Morton <[email protected]>
Signed-off-by Duane Griffin <[email protected]>
---
Version 4, this time with size_t instead of unsigned. Thanks Al!
include/linux/namei.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
include/linux/namei.h +5 -0
@@ -94,4 +94,9 @@ static inline char *nd_get_link(struct nameidata *nd) return nd->saved_names[nd->depth]; } +static inline void nd_terminate_link (void *name,size_t len,size_t maxlen) +{ + ((char *) name)[min (len, maxlen)] ='\0' ; +} +#endif /* _LINUX_NAMEI_H */
Signature · 1 line
1.6.0.4
PATCH 1/1 vfs: introduce helper function to safely NUL-terminate symlinks
A number of filesystems were potentially triggering kernel bugs due to corrupted symlink names on disk. This helper helps safely terminate the names.
Cc Al Viro <[email protected]>
Cc Andrew Morton <[email protected]>
Signed-off-by Duane Griffin <[email protected]>
--- include/linux/namei.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
include/linux/namei.h +5 -0
@@ -94,4 +94,9 @@ static inline char *nd_get_link(struct nameidata *nd) return nd->saved_names[nd->depth]; } +static inline void nd_terminate_link (void *name,size_t len,size_t maxlen) +{ + ((char *) name)[min (len, maxlen)] ='\0' ; +} +#endif /* _LINUX_NAMEI_H */
Signature · 1 line
1.6.0.4