aboutsummaryrefslogtreecommitdiff
path: root/loader/loader.c
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2014-12-02 18:12:51 -0700
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2014-12-02 18:21:03 -0700
commitec7ff74a979f68c48954487c3a0bf335dcc6359c (patch)
tree40bf0db3dfd4cd198ac9c4c0156f48571dd58c3c /loader/loader.c
parent92fb43936b05af9c11aa692cd9b5c325773dfe2d (diff)
downloadusermoji-ec7ff74a979f68c48954487c3a0bf335dcc6359c.tar.xz
loader: Fix missing terminator on string
strncpy does not copy the terminating null character so were getting invalid directory names. Since we know there is enough space for the string, just copy it and get the terminator as well.
Diffstat (limited to 'loader/loader.c')
-rw-r--r--loader/loader.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/loader/loader.c b/loader/loader.c
index dcdc5fa1..6cb7b136 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -412,7 +412,11 @@ static void layer_lib_scan(const char * libInPaths)
return;
}
loader.layer_dirs = malloc(len+1);
- strncpy(loader.layer_dirs, p, len);
+ if (loader.layer_dirs == NULL)
+ return;
+
+ // Alloc passed, so we know there is enough space to hold the string, don't need strncpy
+ strcpy(loader.layer_dirs, p);
libPaths = loader.layer_dirs;
/* cleanup any previously scanned libraries */