From: Martin Peschke <mp3@de.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [Patch] statistics: fix string termination
Date: Tue, 10 Apr 2007 17:47:38 +0200 [thread overview]
Message-ID: <1176220058.5572.11.camel@dix> (raw)
Make sure strsep() in statistic_release_def() finds a terminanal '\0' and
doesn't attempt to access bytes outside the given buffer.
(Patch fixes
statistics-infrastructure-simplify-statistics-debugfs-write-function.patch)
Patch is against 2.6.21-rc6-mm1.
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
---
statistic.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: linux/lib/statistic.c
===================================================================
--- linux.orig/lib/statistic.c
+++ linux/lib/statistic.c
@@ -627,9 +627,10 @@ static ssize_t statistic_write_def(struc
return -EPIPE;
if (*offset + len > 16 * PAGE_SIZE)
return -ENOMEM;
- larger = kmalloc(*offset + len, GFP_KERNEL);
+ larger = kmalloc(*offset + len + 1, GFP_KERNEL);
if (!larger)
return -ENOMEM;
+ larger[*offset + len] = '\0';
memcpy(larger, seq_priv->w_buf, *offset);
if (copy_from_user(larger + *offset, buf, len))
return -EFAULT;
reply other threads:[~2007-04-10 15:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1176220058.5572.11.camel@dix \
--to=mp3@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@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