diff options
author | Bob Moore <robert.moore@intel.com> | 2013-10-29 09:29:21 +0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-30 12:24:21 +0100 |
commit | 73424473d0801f7079258897901ba1edc660dbd3 (patch) | |
tree | a1a84628fe0799dda1fa12471ff8592bd5fff73d /drivers/acpi/acpica/acutils.h | |
parent | c26f3c908091294e5909f5459b6682e10922c824 (diff) | |
download | linux-73424473d0801f7079258897901ba1edc660dbd3.tar.bz2 |
ACPICA: Add safe versions of common string functions.
This change adds and deploys "safe" versions of strcpy and strcat that
ensure that the target buffer does not overflow. These safe functions
are only helpful for processing user input and command lines. For most
ACPICA code however, the required buffer length is precisely calculated
before buffer allocation, so the use of these functions is unnecessary.
ACPICA BZ 1043.
This change only applies to the ACPICA utilities and the debugger, none
of which are not shipped with the kernel yet, so the kernel's behavior
remains unchanged after it.
References: https://bugs.acpica.org/show_bug.cgi?id=1043
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/acutils.h')
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index d5a62a6182bb..4f25e8f0cd5f 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h @@ -628,6 +628,17 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position); void acpi_ut_repair_name(char *name); +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) +u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source); + +u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source); + +u8 +acpi_ut_safe_strncat(char *dest, + acpi_size dest_size, + char *source, acpi_size max_transfer_length); +#endif + /* * utmutex - mutex support */ |