From 88b84ec200091bdf5754b435ef55dfcd30078a67 Mon Sep 17 00:00:00 2001 From: Ningsheng Jian Date: Wed, 17 Sep 2014 13:34:09 +0800 Subject: NativeHelper: Avoid returning local stack string Refactor JniInvocation::GetLibrary to not return a stack-allocated string. Instead, provide a char buffer. Bug: 16404669 Change-Id: I34f4a40e28bc491ba630a2b1bff5792e34937101 --- include/nativehelper/JniInvocation.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/nativehelper/JniInvocation.h b/include/nativehelper/JniInvocation.h index b5198ff..fc2ed0a 100644 --- a/include/nativehelper/JniInvocation.h +++ b/include/nativehelper/JniInvocation.h @@ -38,8 +38,11 @@ class JniInvocation { // persist.sys.dalvik.vm.lib. bool Init(const char* library); - // Exposes which library is actually loaded from the given name. - static const char* GetLibrary(const char* library); + // Exposes which library is actually loaded from the given name. The + // buffer of size PROPERTY_VALUE_MAX will be used to load the system + // property for the default library, if necessary. If no buffer is + // provided, the fallback value will be used. + static const char* GetLibrary(const char* library, char* buffer); private: -- cgit v1.2.3