Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ca846e9 authored by Bob Moore's avatar Bob Moore Committed by Len Brown
Browse files

ACPICA: Add support for zero-length buffer-to-string conversions

Allow zero length strings during interpreter buffer-to-string
conversions. For example, during the ToDecimalString and
ToHexString operaters, as well as implicit conversions. Fiodor
Suietov.  ACPICA BZ 585.

http://www.acpica.org/bugzilla/show_bug.cgi?id=585



Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent e8707b34
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -512,9 +512,14 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
		/*
		 * Create a new string object and string buffer
		 * (-1 because of extra separator included in string_length from above)
		 * Allow creation of zero-length strings from zero-length buffers.
		 */
		if (string_length) {
			string_length--;
		}

		return_desc = acpi_ut_create_string_object((acpi_size)
							   (string_length - 1));
							   string_length);
		if (!return_desc) {
			return_ACPI_STATUS(AE_NO_MEMORY);
		}
@@ -537,7 +542,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
		 * Null terminate the string
		 * (overwrites final comma/space from above)
		 */
		if (obj_desc->buffer.length) {
			new_buf--;
		}
		*new_buf = 0;
		break;