From 735206b1a53c8af09e0061773852d10a63c65d3e Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 7 Jul 2023 12:11:00 -0400 Subject: [PATCH] Clarify null-termination of name field Test: make Change-Id: I22e7c20074fe49bd533fc16c88a979447362d3f2 --- .../graphics/allocator/BufferDescriptorInfo.aidl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl b/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl index 50aa2b7c7a..7194ebebe6 100644 --- a/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl +++ b/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl @@ -23,7 +23,14 @@ import android.hardware.graphics.common.PixelFormat; @VintfStability parcelable BufferDescriptorInfo { /** - * The name of the buffer in ASCII. Useful for debugging/tracing. + * The name of the buffer in null-terminated ASCII. Useful for debugging/tracing. + * + * NOTE: While a well behaved client will ensure it passes a null-terminated string + * within the 128-byte limit, the IAllocator service implementation should be + * be defensive against malformed input. As such, it is recommended that + * IAllocator implementations proactively do `name[127] = 0` upon receiving + * an allocation request to enusre that the string is definitely + * null-terminated regardless of what the client sent. */ byte[128] name;