From: "Tobin C. Harding" <me@tobin.cc>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
noralf@tronnes.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
"Tobin C. Harding" <me@tobin.cc>
Subject: [PATCH v2 1/3] staging: fbtft: Fix buffer overflow vulnerability
Date: Wed, 15 Feb 2017 14:27:23 +1100 [thread overview]
Message-ID: <1487129245-24970-2-git-send-email-me@tobin.cc> (raw)
In-Reply-To: <1487129245-24970-1-git-send-email-me@tobin.cc>
Module copies a user supplied string (module parameter) into a buffer
using strncpy() and does not check that the buffer is null terminated.
Replace call to strncpy() with call to strlcpy() ensuring that the
buffer is null terminated.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
drivers/staging/fbtft/fbtft_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index de46f8d..7b7223b 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -1483,7 +1483,7 @@ static int __init fbtft_device_init(void)
displays[i].pdev->name = name;
displays[i].spi = NULL;
} else {
- strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE);
+ strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE);
displays[i].pdev = NULL;
}
}
--
2.7.4
next prev parent reply other threads:[~2017-02-15 3:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 3:27 [PATCH v2 0/3] staging: fbtft: Fix buffer overflow vulnerability Tobin C. Harding
2017-02-15 3:27 ` Tobin C. Harding [this message]
2017-02-15 3:27 ` [PATCH v2 2/3] staging: fbtft: Replace magic number with constant Tobin C. Harding
2017-02-15 3:36 ` Joe Perches
2017-02-15 3:27 ` [PATCH v2 3/3] staging: fbtft: Add check on strlcpy() return value Tobin C. Harding
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=1487129245-24970-2-git-send-email-me@tobin.cc \
--to=me@tobin.cc \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noralf@tronnes.org \
--cc=thomas.petazzoni@free-electrons.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