From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] drivers\char\synclink.c
Date: Sat, 26 Nov 2005 09:21:56 +0000 [thread overview]
Message-ID: <43882934.3070103@bfs.de> (raw)
In-Reply-To: <005701c5f201$6f7bf190$1e83c756@bureau>
Nish Aravamudan wrote:
> On 11/25/05, Matthew Wilcox <matthew@wil.cx> wrote:
>> On Fri, Nov 25, 2005 at 01:34:03PM -0800, Nish Aravamudan wrote:
>>> On 11/25/05, Christophe Jaillet <christophe.jaillet@wanadoo.fr> wrote:
>>>> In file : \drivers\char\synclink.c
>>>> In function : line_info(char *buf, struct mgsl_struct *info)
>>>>
>>>> The buffer *stat_buf* could be defined smaller.
>>>
>>> Where's the patch?
>> Never mind that. Is this a patch we even want? It's quite common to
>> overallocate these small string buffers so that when someone makes a
>> change and forgets to update the length, they don't overrun the buffer.
>
> Valid point. And the savings by reducing it aren't significant enough
> to justify the potential error you mention.
>
>> And what's with the backward slashes anyway?
>
The problem with fixed size buffers is exactly THE problem if unwary
change the length they cause errors.
ppl writing into buffer should use snprintf() (and friends).
To find the lenght any can use snprintf(NULL,...).
that cost time but fixes any possible overflow.
re,
walter
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2005-11-26 9:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-25 20:47 [KJ] drivers\char\synclink.c Christophe Jaillet
2005-11-25 21:34 ` Nish Aravamudan
2005-11-26 0:46 ` Matthew Wilcox
2005-11-26 0:58 ` Nish Aravamudan
2005-11-26 9:21 ` walter harms [this message]
2005-11-26 17:12 ` Nish Aravamudan
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=43882934.3070103@bfs.de \
--to=wharms@bfs.de \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.