From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: Wouter Paesen <wouter@kangaroot.net>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 2.6.17-rc6] input/mouse/sermouse: fix memleak and potential buffer overflow
Date: Wed, 21 Jun 2006 18:23:37 +0200 [thread overview]
Message-ID: <200606211823.43160@bilbo.math.uni-mannheim.de> (raw)
In-Reply-To: <20060620064127.GA25367@tougher.kangaroot.net>
[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]
Wouter Paesen wrote:
>On Sun, Jun 18, 2006 at 12:24:31AM -0400, Dmitry Torokhov wrote:
>> > Because serio->phys is also a 32 character field the sprintf could
>> > result in 39 characters being written to the sermouse->phys.
>>
>> Right, we need to change it to use snprintf.
>
>Thanks, this patch will do just that.
>Still, keeping the array 39 characters long will prevent truncation of the
> string.
>
>Signed-off-by: Wouter Paesen <wouter@kangaroot.net>
>
>--- linux-2.6.17-rc6.orig/drivers/input/mouse/sermouse.c 2006-06-20
> 08:31:12.000000000 +0200 +++
> linux-2.6.17-rc6/drivers/input/mouse/sermouse.c 2006-06-20
> 08:31:41.000000000 +0200 @@ -53,7 +53,7 @@ struct sermouse {
> unsigned char count;
> unsigned char type;
> unsigned long last;
>- char phys[32];
>+ char phys[39];
> };
>
> /*
>@@ -254,7 +254,7 @@ static int sermouse_connect(struct serio
> goto fail;
>
> sermouse->dev = input_dev;
>- sprintf(sermouse->phys, "%s/input0", serio->phys);
>+ snprintf(sermouse->phys, 39, "%s/input0", serio->phys);
This adds a magic number here. I suggest using sizeof(sermouse->phys) instead.
Eike
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2006-06-21 16:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-15 10:47 Wouter Paesen
2006-06-18 4:24 ` Dmitry Torokhov
2006-06-20 6:41 ` Wouter Paesen
2006-06-21 16:23 ` Rolf Eike Beer [this message]
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=200606211823.43160@bilbo.math.uni-mannheim.de \
--to=eike-kernel@sf-tec.de \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=wouter@kangaroot.net \
/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®