netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Armin Schindler <armin@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] eicon: make buffer larger
Date: Wed, 6 Oct 2010 10:31:17 +0200	[thread overview]
Message-ID: <20101006083117.GF5409@bicker> (raw)
In-Reply-To: <alpine.DEB.2.00.1010061019480.29404@justus.melware.de>

On Wed, Oct 06, 2010 at 10:21:02AM +0200, Armin Schindler wrote:
> On Wed, 6 Oct 2010, Dan Carpenter wrote:
>> On Wed, Oct 06, 2010 at 09:25:44AM +0200, Armin Schindler wrote:
>>> On Mon, 4 Oct 2010, Dan Carpenter wrote:
>>>> In diva_mnt_add_xdi_adapter() we do this:
>>>>  strcpy (clients[id].drvName,     tmp);
>>>>  strcpy (clients[id].Dbg.drvName, tmp);
>>>>
>>>> The "clients[id].drvName" is a 128 character buffer and
>>>> "clients[id].Dbg.drvName" was originally a 16 character buffer but I've
>>>> changed it to 128 as well.  We don't actually use 128 characters but we
>>>> do use more than 16.
>>>
>>> I don't see any reason for that change. The driver names here do not use
>>> more than 16 characters and when filled, the length is checked anyway.
>>> Please avoid changing the size of that structure.
>>>
>>
>> drivers/isdn/hardware/eicon/debug.c diva_mnt_add_xdi_adapter()
>>   874      sprintf (tmp, "ADAPTER:%d SN:%u-%d",
>>                           12345678 90123 45 67
>>
>> 	That's a minimum 17 characters.
>>
>>   875               (int)logical,
>>   876               serial & 0x00ffffff,
>>   877               (byte)(((serial & 0xff000000) >> 24) + 1));
>>   878    } else {
>>   879      sprintf (tmp, "ADAPTER:%d SN:%u", (int)logical, serial);
>>   880    }
>
> this is tmp with a bigger size. It seems you are mixing the sizes of  
> drvName and tmp.
>

What I mean is that later on we use strcpy() to copy "tmp" into
"clients[id].Dbg.drvName"

   927    strcpy (clients[id].drvName,     tmp);
   928    strcpy (clients[id].Dbg.drvName, tmp);
                               ^
                    this buffer is only 16 chars

regards,
dan carpenter

> Armin

  reply	other threads:[~2010-10-06  8:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 19:24 [patch] eicon: make buffer larger Dan Carpenter
2010-10-06  7:25 ` Armin Schindler
2010-10-06  7:47   ` Dan Carpenter
2010-10-06  8:16     ` walter harms
2010-10-06  8:21     ` Armin Schindler
2010-10-06  8:31       ` Dan Carpenter [this message]
2010-10-06  8:44         ` Armin Schindler
2010-10-06 12:11           ` Dan Carpenter
2010-10-06 12:49             ` Armin Schindler
2010-10-07  6:30 ` David Miller

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=20101006083117.GF5409@bicker \
    --to=error27@gmail.com \
    --cc=armin@melware.de \
    --cc=isdn@linux-pingi.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).