From: "H. Peter Anvin" <hpa@zytor.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: mingo@redhat.com, LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ia32: strncpy does not null terminate string
Date: Tue, 21 Jul 2009 11:27:29 -0700 [thread overview]
Message-ID: <4A660891.7070105@zytor.com> (raw)
In-Reply-To: <4A60755F.4030604@gmail.com>
Roel Kluin wrote:
>
> diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
> index 085a8c3..b114f57 100644
> --- a/arch/x86/ia32/sys_ia32.c
> +++ b/arch/x86/ia32/sys_ia32.c
> @@ -687,7 +687,7 @@ long sys32_vm86_warning(void)
> compat_printk(KERN_INFO
> "%s: vm86 mode not supported on 64 bit kernel\n",
> me->comm);
> - strncpy(lastcomm, me->comm, sizeof(lastcomm));
> + strncpy(lastcomm, me->comm, sizeof(lastcomm) - 1);
> }
> return -ENOSYS;
> }
I don't see any problem with the code as written. It is of course
correct that strncpy() doesn't null-terminate (it null-pads, which is
somewhat inefficient, but has info leak advantages), *however*, the only
user (it's a local static variable) uses strncpy(), so that's fine.
It probably could be done cleaner, but there is no actual bug, so I
personally don't see any reason to change it just in the interest of
avoiding churn.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
prev parent reply other threads:[~2009-07-21 18:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-17 12:58 [PATCH] ia32: strncpy does not null terminate string Roel Kluin
2009-07-17 14:19 ` Roel Kluin
2009-07-21 18:27 ` H. Peter Anvin [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=4A660891.7070105@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=roel.kluin@gmail.com \
/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.