diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-15 00:07:53 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-15 00:07:53 +0000 |
commit | dbd90a1fc3692687c347337df856e4fee098451d (patch) | |
tree | 8a5d133f1c9c6dc833bfde097a8a033bc25835e0 /base/HidlSupport.cpp | |
parent | c12f9b9aa5a87e996f5e69f3988f417aab8dd01b (diff) | |
parent | e55dec192cc59f58a2883d4a9f694a0de59c9bf1 (diff) | |
download | libhidl-android-mainline-12.0.0_r20.tar.gz |
Snap for 7550640 from e55dec192cc59f58a2883d4a9f694a0de59c9bf1 to mainline-wifi-releaseandroid-mainline-12.0.0_r96android-mainline-12.0.0_r83android-mainline-12.0.0_r67android-mainline-12.0.0_r57android-mainline-12.0.0_r40android-mainline-12.0.0_r20android-mainline-12.0.0_r126android-mainline-12.0.0_r114aml_wif_311811030android12-mainline-wifi-release
Change-Id: I328c6bf093eb8138186ec13fb8b7f7e782fa45cd
Diffstat (limited to 'base/HidlSupport.cpp')
-rw-r--r-- | base/HidlSupport.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp index af805b9..78faa2f 100644 --- a/base/HidlSupport.cpp +++ b/base/HidlSupport.cpp @@ -217,6 +217,14 @@ void hidl_string::copyFrom(const char *data, size_t size) { if (size >= UINT32_MAX) { LOG(FATAL) << "string size can't exceed 2^32 bytes: " << size; } + + if (size == 0) { + mBuffer = kEmptyString; + mSize = 0; + mOwnsBuffer = false; + return; + } + char *buf = (char *)malloc(size + 1); memcpy(buf, data, size); buf[size] = '\0'; |