audio/al: replace strcat with strlcat
Comment from golang.org/cl/6642. As bionic (surprisingly) has strlcat, using it instead of strncat. If you're not familiar with the l-variants, see http://www.sudo.ws/todd/papers/strlcpy.html Change-Id: I69958ee99917903f9d10dda0ec99111c4793db71 Reviewed-on: https://go-review.googlesource.com/7011 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
269086b6fe
commit
c30f429855
|
@ -9,6 +9,7 @@ package al
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -42,8 +43,8 @@ void* al_init(void* vm, void* context) {
|
||||||
const char *cpackage_name = (*env)->GetStringUTFChars(env, package_name, 0);
|
const char *cpackage_name = (*env)->GetStringUTFChars(env, package_name, 0);
|
||||||
|
|
||||||
char lib_path[PATH_MAX] = "/data/data/";
|
char lib_path[PATH_MAX] = "/data/data/";
|
||||||
strcat(lib_path, cpackage_name);
|
strlcat(lib_path, cpackage_name, sizeof(lib_path));
|
||||||
strcat(lib_path, "/lib/libopenal.so");
|
strlcat(lib_path, "/lib/libopenal.so", sizeof(lib_path));
|
||||||
void* handle = dlopen(lib_path, RTLD_LAZY);
|
void* handle = dlopen(lib_path, RTLD_LAZY);
|
||||||
(*env)->ReleaseStringUTFChars(env, package_name, cpackage_name);
|
(*env)->ReleaseStringUTFChars(env, package_name, cpackage_name);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
|
|
Loading…
Reference in New Issue