From: "Julio Auto" <mindvortex@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.6.17.9 Incorrect string length checking in param_set_copystring()
Date: Sun, 20 Aug 2006 07:47:29 -0700 [thread overview]
Message-ID: <18d709710608200747k3323b23cq70eb52fdb9032554@mail.gmail.com> (raw)
As for 2.6.17.9, linux/include/linux/moduleparam.h suggests the user
of module_param_string() to set the maxlen parameter to
strlen(string), ie. '\0' excluded. However the function that actually
sets the string (param_set_copystring()), doesn't accept inputs with
maxlen-1 characters, reporting that the supplied string should fit
maxlen-1 chars.
See patch below.
Cheers,
Julio Auto
--- linux-2.6.17.9/kernel/params.c.old 2006-08-19 20:48:30.000000000 -0700
+++ linux-2.6.17.9/kernel/params.c 2006-08-19 20:49:15.000000000 -0700
@@ -351,9 +351,9 @@ int param_set_copystring(const char *val
{
struct kparam_string *kps = kp->arg;
- if (strlen(val)+1 > kps->maxlen) {
+ if (strlen(val) > kps->maxlen) {
printk(KERN_ERR "%s: string doesn't fit in %u chars.\n",
- kp->name, kps->maxlen-1);
+ kp->name, kps->maxlen);
return -ENOSPC;
}
strcpy(kps->string, val);
next reply other threads:[~2006-08-20 14:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-20 14:47 Julio Auto [this message]
2006-08-20 16:17 ` Julio Auto
2006-08-21 8:39 ` Jan Engelhardt
2006-08-20 21:14 ` Luca
2006-08-20 21:39 ` Julio Auto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18d709710608200747k3323b23cq70eb52fdb9032554@mail.gmail.com \
--to=mindvortex@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®