All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: mchehab@s-opensource.com, alan@linux.intel.com
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 11/13] staging: media: atomisp: putting NULs in the wrong place
Date: Thu, 18 May 2017 15:50:20 +0200	[thread overview]
Message-ID: <20170518135022.6069-12-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20170518135022.6069-1-gregkh@linuxfoundation.org>

From: Dan Carpenter <dan.carpenter@oracle.com>

We're putting the NUL terminators one space beyond where they belong.
This doesn't show up in testing because all but the callers put a NUL in
the correct place themselves.  LOL.  It causes a static checker warning
about buffer overflows.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 .../pci/atomisp2/css2400/hive_isp_css_include/string_support.h        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
index 74b5a1c7ac9a..c53241a7a281 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
@@ -117,7 +117,7 @@ STORAGE_CLASS_INLINE int strncpy_s(
 
 	/* dest_str is big enough for the len */
 	strncpy(dest_str, src_str, len);
-	dest_str[len+1] = '\0';
+	dest_str[len] = '\0';
 	return 0;
 }
 
@@ -157,7 +157,7 @@ STORAGE_CLASS_INLINE int strcpy_s(
 
 	/* dest_str is big enough for the len */
 	strncpy(dest_str, src_str, len);
-	dest_str[len+1] = '\0';
+	dest_str[len] = '\0';
 	return 0;
 }
 
-- 
2.13.0

  parent reply	other threads:[~2017-05-18 13:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 13:50 [PATCH 00/13] staging: media: atomisp queued up patches Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 01/13] staging: media: atomisp: Add __printf validation and fix fallout Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 02/13] staging: media: atomisp: use logical AND, not bitwise Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 03/13] staging: media: atomisp: Fix unnecessary initialization of static Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 04/13] staging: media: atomisp: fixed sparse warnings Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 05/13] staging: media: atomisp: drop unused qos variable Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 06/13] staging: media: atomisp: fixed coding style errors Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 07/13] staging: media: atomisp: fix coding style warnings Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 08/13] staging: media: atomisp: Make undeclared symbols static Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 09/13] staging: media: atomisp: Fix -Werror=int-in-bool-context compile errors Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 10/13] staging: media: atomisp: one char read beyond end of string Greg Kroah-Hartman
2017-05-18 13:50 ` Greg Kroah-Hartman [this message]
2017-05-18 13:50 ` [PATCH 12/13] staging: media: atomisp: fix missing blank line coding style issue in atomisp_tpg.c Greg Kroah-Hartman
2017-05-18 13:50 ` [PATCH 13/13] staging: media: atomisp: don't treat warnings as errors Greg Kroah-Hartman
2017-05-18 14:10 ` [PATCH 00/13] staging: media: atomisp queued up patches Mauro Carvalho Chehab
2017-05-18 16:40   ` Alan Cox
2017-05-19 10:54     ` Mauro Carvalho Chehab

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=20170518135022.6069-12-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alan@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@s-opensource.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.