diff options
| author | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2014-12-02 18:12:51 -0700 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2014-12-02 18:21:03 -0700 |
| commit | ec7ff74a979f68c48954487c3a0bf335dcc6359c (patch) | |
| tree | 40bf0db3dfd4cd198ac9c4c0156f48571dd58c3c | |
| parent | 92fb43936b05af9c11aa692cd9b5c325773dfe2d (diff) | |
| download | usermoji-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.
| -rw-r--r-- | loader/loader.c | 6 |
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 */ |
