Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPICA: Replace strncpy() with memcpy()

ACPICA commit 83019b471e1902151e67c588014ba2d09fa099a3

strncpy() is deprecated for NUL-terminated destination buffers[1].

Use memcpy() for length-bounded destinations.

Link: https://github.com/KSPP/linux/issues/90 [1]
Link: https://github.com/acpica/acpica/commit/83019b47
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/1910878.atdPhlSkOF@rjwysocki.net

authored by

Ahmed Salem and committed by
Rafael J. Wysocki
ebf27765 70662db7

+6 -6
+2 -2
drivers/acpi/acpica/exconvrt.c
··· 226 226 /* Copy the string to the buffer */ 227 227 228 228 new_buf = return_desc->buffer.pointer; 229 - strncpy((char *)new_buf, (char *)obj_desc->string.pointer, 230 - obj_desc->string.length); 229 + memcpy((char *)new_buf, (char *)obj_desc->string.pointer, 230 + obj_desc->string.length); 231 231 break; 232 232 233 233 default:
+2 -2
drivers/acpi/acpica/tbfind.c
··· 57 57 58 58 memset(&header, 0, sizeof(struct acpi_table_header)); 59 59 ACPI_COPY_NAMESEG(header.signature, signature); 60 - strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); 61 - strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); 60 + memcpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); 61 + memcpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); 62 62 63 63 /* Search for the table */ 64 64
+1 -1
drivers/acpi/acpica/utnonansi.c
··· 168 168 { 169 169 /* Always terminate destination string */ 170 170 171 - strncpy(dest, source, dest_size); 171 + memcpy(dest, source, dest_size); 172 172 dest[dest_size - 1] = 0; 173 173 } 174 174
+1 -1
include/acpi/actypes.h
··· 522 522 #define ACPI_COPY_NAMESEG(dest,src) (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src))) 523 523 #else 524 524 #define ACPI_COMPARE_NAMESEG(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAMESEG_SIZE)) 525 - #define ACPI_COPY_NAMESEG(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAMESEG_SIZE)) 525 + #define ACPI_COPY_NAMESEG(dest,src) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAMESEG_SIZE)) 526 526 #endif 527 527 528 528 /* Support for the special RSDP signature (8 characters) */