Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1741661
| From | Jean Delvare <jdelvare@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/3] params: Fix the maximum length in param_get_string |
| Date | 2017-09-28 17:50 +0200 |
| Message-ID | <uuJez-2kP-43@gated-at.bofh.it> (permalink) |
| References | <uuJey-2kP-11@gated-at.bofh.it> |
| Organization | SUSE Linux |
The length parameter of strlcpy() is supposed to reflect the size of
the target buffer, not of the source string. Harmless in this case as
the buffer is PAGE_SIZE long and the source string is always much
shorter than this, but conceptually wrong, so let's fix it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Changes since v1:
* Patch added
kernel/params.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-4.13.orig/kernel/params.c 2017-09-28 11:09:09.604089430 +0200
+++ linux-4.13/kernel/params.c 2017-09-28 11:09:47.573434740 +0200
@@ -507,7 +507,7 @@ EXPORT_SYMBOL(param_set_copystring);
int param_get_string(char *buffer, const struct kernel_param *kp)
{
const struct kparam_string *kps = kp->str;
- return strlcpy(buffer, kps->string, kps->maxlen);
+ return strlcpy(buffer, kps->string, PAGE_SIZE);
}
EXPORT_SYMBOL(param_get_string);
--
Jean Delvare
SUSE L3 Support
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/3] params: Fix potential buffer overflows Jean Delvare <jdelvare@suse.de> - 2017-09-28 17:50 +0200 [PATCH v2 2/3] params: Fix an overflow in param_attr_show Jean Delvare <jdelvare@suse.de> - 2017-09-28 17:50 +0200 [PATCH v2 1/3] params: Fix the maximum length in param_get_string Jean Delvare <jdelvare@suse.de> - 2017-09-28 17:50 +0200 Re: [PATCH v2 0/3] params: Fix potential buffer overflows Ingo Molnar <mingo@kernel.org> - 2017-09-28 18:00 +0200
csiph-web