mirror of
https://github.com/acpica/acpica/
synced 2025-02-05 16:14:06 +03:00
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.
This commit is contained in:
parent
b0a4040faf
commit
1f1bb7db67
@ -638,8 +638,14 @@ AcpiExConvertToString (
|
||||
/*
|
||||
* Create a new string object and string buffer
|
||||
* (-1 because of extra separator included in StringLength from above)
|
||||
* Allow creation of zero-length strings from zero-length buffers.
|
||||
*/
|
||||
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
|
||||
if (StringLength)
|
||||
{
|
||||
StringLength--;
|
||||
}
|
||||
|
||||
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
|
||||
if (!ReturnDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -663,7 +669,10 @@ AcpiExConvertToString (
|
||||
* Null terminate the string
|
||||
* (overwrites final comma/space from above)
|
||||
*/
|
||||
NewBuf--;
|
||||
if (ObjDesc->Buffer.Length)
|
||||
{
|
||||
NewBuf--;
|
||||
}
|
||||
*NewBuf = 0;
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user