mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@frankl.hpl.hp.com>
Subject: [PATCH] fix for buffer limit for long in sysctl.c
Date: Thu, 15 Jul 2004 14:40:21 -0700	[thread overview]
Message-ID: <20040715214021.GC1557@frankl.hpl.hp.com> (raw)

Andrew,

We discovered a bug in the do_proc_doulongvec_minmax() routine.
The buffer is too short by one byte. A 64-bit number expressed 
in decimal uses 20 bytes. The size of the buffer was set to 20. 
The following patch relative to 2.6.7 fixes the problem. For 
consistency reason, a length of 21 is used for both int and 
long parsers.

change-log:
	fix a bug in do_proc_doulongvec_minmax() where the
	the string buffer was too short to parse a 64-bit number
	expressed in decimal. That was causing problems with entries
	in  /proc/sys using long and allowing large number (such as -1)

signed-off-by: Stephane Eranian <eranian@hpl.hp.com>

===== kernel/sysctl.c 1.65 vs edited =====
--- 1.65/kernel/sysctl.c        2004-06-16 21:12:21 -07:00
+++ edited/kernel/sysctl.c      2004-07-15 14:38:34 -07:00
@@ -1442,7 +1442,7 @@
                              int write, void *data),
                  void *data)
 {
-#define TMPBUFLEN 20
+#define TMPBUFLEN 21
        int *i, vleft, first=1, neg, val;
        unsigned long lval;
        size_t left, len;
@@ -1682,7 +1682,7 @@
                                     unsigned long convmul,
                                     unsigned long convdiv)
 {
-#define TMPBUFLEN 20
+#define TMPBUFLEN 21
        unsigned long *i, *min, *max, val;
        int vleft, first=1, neg;
        size_t len, left;

-- 

-Stephane

                 reply	other threads:[~2004-07-15 21:49 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=20040715214021.GC1557@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=akpm@osdl.org \
    --cc=eranian@frankl.hpl.hp.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®