mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Alexander Strakh <strakh@ispras.ru>
Cc: Matthew Wilcox <willy@linux.intel.com>,
	Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>,
	Andy Grover <andrew.grover@intel.com>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: BUG printk with not null-terminated string in driver /drivers/acpi/osl.c
Date: Tue, 22 Dec 2009 18:12:48 +0100	[thread overview]
Message-ID: <20091222171248.GA20318@atjola.homenet> (raw)
In-Reply-To: <200912221846.02318.strakh@ispras.ru>

On 2009.12.22 18:46:02 +0000, Alexander Strakh wrote:
>         In driver drivers/acpi/osl.c in function acpi_osi_setup:
> 1. If in line 555 *osi_additional_string == 0 then we goto line 1039

I guess that's meant to be line 1038?

> 2. In line 1039: if length of str > OSI_STRING_LENGTH_MAX then 
> osi_additional_string not have 0 at the end.
> 3. In line 1040 printk called with not null-terminated string.

That printk uses str, not osi_additional_string.

> diff --git a/./0000/drivers/acpi/osl.c b/./0001/drivers/acpi/osl.c
> index 02e8464..9c759f8 100644
> --- a/./0000/drivers/acpi/osl.c
> +++ b/./0001/drivers/acpi/osl.c
> @@ -1037,6 +1037,7 @@ int __init acpi_osi_setup(char *str)
>  		acpi_cmdline_osi_linux(1);	/* enable */
>  	} else if (*osi_additional_string == '\0') {
>  		strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
> +		osi_additional_string[OSI_STRING_LENGTH_MAX - 1] = 0;

That will break the test in acpi_os_validate_interface for strings
longer than OSI_STRING_LENGTH_MAX (incl. the NUL byte). And that's the
only other user of osi_additional_string and doesn't require the
terminating NUL byte. So this shouldn't be needed.

Björn

      reply	other threads:[~2009-12-22 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22 18:46 Alexander Strakh
2009-12-22 17:12 ` Björn Steinbrink [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=20091222171248.GA20318@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=andrew.grover@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.s.diefenbaugh@intel.com \
    --cc=strakh@ispras.ru \
    --cc=willy@linux.intel.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 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®