linux kernel bug report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello there,

I just ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.33

It said

Checking ./drivers/acpi/osl.c...
[./drivers/acpi/osl.c:1039]: (style) After a strncpy() the buffer should be zero-terminated

The source code is

               strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);

I checked the source code and I agree with cppcheck.
Proposed patch file attached.


Regards

David Binderman
 		 	   		  
_________________________________________________________________
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
Signed-off-by: David Binderman <dcb314@xxxxxxxxxxx>

--- drivers/acpi/osl.c.sav	2010-03-08 10:24:02.000000000 +0000
+++ drivers/acpi/osl.c	2010-03-08 10:24:22.000000000 +0000
@@ -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);
+		str[OSI_STRING_LENGTH_MAX - 1] = 0;
 		printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
 	}
 

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux