summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorJeff Boody <jboody@quicinc.com>2011-01-27 18:12:09 -0700
committerMathias Agopian <mathias@google.com>2011-05-11 18:05:49 -0700
commite647f3c76c5d401d5b1cc0d8a08b314bf467113d (patch)
tree97502a1c906a5bccbc88d93ac6fa2062be1867ca /opengl
parentf38ab8b3a46d471dbb3e5835ce4be8d7ea00d06d (diff)
downloadframeworks_native-e647f3c76c5d401d5b1cc0d8a08b314bf467113d.zip
frameworks_native-e647f3c76c5d401d5b1cc0d8a08b314bf467113d.tar.gz
frameworks_native-e647f3c76c5d401d5b1cc0d8a08b314bf467113d.tar.bz2
add OES postfix without truncating function
Change-Id: Id47304cf38914190cec58d703801f456ab916f63
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/Loader.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 2502f15..75dec4a 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -200,11 +200,13 @@ void Loader::init_api(void* dso,
}
if (f == NULL) {
// Try with the OES postfix
- ssize_t index = ssize_t(strlen(name)) - 3;
+ ssize_t size = ssize_t(strlen(name));
+ ssize_t index = size - 3;
if ((index>0 && (index<252)) && (strcmp(name+index, "OES"))) {
- strncpy(scrap, name, index);
- scrap[index] = 0;
- strcat(scrap, "OES");
+ strncpy(scrap, name, sizeof(scrap) - 1);
+ scrap[size] = 0;
+ strncat(scrap, "OES", sizeof(scrap) - 1);
+ scrap[size + 3] = 0;
f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
//LOGD_IF(f, "found <%s> instead", scrap);
}