]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] atomisp: putting NULs in the wrong place
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 18 May 2017 13:50:20 +0000 (10:50 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 19 May 2017 09:57:35 +0000 (06:57 -0300)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h

index 74b5a1c7ac9a43b59cca9c5a61ae1d8fc34928b2..c53241a7a28163a8ccac267c7fdf4b6353d63fab 100644 (file)
@@ -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;
 }