diff options
author | Mike Marshall <hubcap@omnibond.com> | 2016-03-14 15:28:34 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-03-14 15:48:28 -0400 |
commit | 53f57fef43f5b9586c7a78acdeae27e206eae48b (patch) | |
tree | 8ddad64ffe7565442e5e0786101f32079fbd16f2 /fs/orangefs | |
parent | ab6652524aaf834d5dcdb46dd7695813b8d63da5 (diff) |
Orangefs: Extra sanity insurance on buffer before using string functions on it.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r-- | fs/orangefs/devorangefs-req.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c index 12ea8730aa5d..35418d0b77bf 100644 --- a/fs/orangefs/devorangefs-req.c +++ b/fs/orangefs/devorangefs-req.c | |||
@@ -678,6 +678,19 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg) | |||
678 | ret = copy_from_user(&client_debug_array_string, | 678 | ret = copy_from_user(&client_debug_array_string, |
679 | (void __user *)arg, | 679 | (void __user *)arg, |
680 | ORANGEFS_MAX_DEBUG_STRING_LEN); | 680 | ORANGEFS_MAX_DEBUG_STRING_LEN); |
681 | /* | ||
682 | * The real client-core makes an effort to ensure | ||
683 | * that actual strings that aren't too long to fit in | ||
684 | * this buffer is what we get here. We're going to use | ||
685 | * string functions on the stuff we got, so we'll make | ||
686 | * this extra effort to try and keep from | ||
687 | * flowing out of this buffer when we use the string | ||
688 | * functions, even if somehow the stuff we end up | ||
689 | * with here is garbage. | ||
690 | */ | ||
691 | client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] = | ||
692 | '\0'; | ||
693 | |||
681 | if (ret != 0) { | 694 | if (ret != 0) { |
682 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", | 695 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", |
683 | __func__); | 696 | __func__); |