Skip to content

Commit

Permalink
The function strncat() adds a terminating '\0' so ensure that there i…
Browse files Browse the repository at this point in the history
…s enough

room for it (#69).
  • Loading branch information
anthony-tuininga committed Aug 6, 2018
1 parent 99b3198 commit ccc448f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dpiOci.c
Expand Up @@ -1426,16 +1426,16 @@ static int dpiOci__findAndCheckDllArchitecture(const char *dllName,
temp = strrchr(fullName, '\\');
if (temp) {
*(temp + 1) = '\0';
strncat(fullName, dllName, sizeof(fullName));
strncat(fullName, dllName, sizeof(fullName) - 1);
if (dpiOci__checkDllArchitecture(fullName) == 0)
found = 1;
}
}

// check current directory
if (!found && GetCurrentDirectory(sizeof(fullName), fullName) != 0) {
strncat(fullName, "\\", sizeof(fullName));
strncat(fullName, dllName, sizeof(fullName));
strncat(fullName, "\\", sizeof(fullName) - 1);
strncat(fullName, dllName, sizeof(fullName) - 1);
if (dpiOci__checkDllArchitecture(fullName) == 0)
found = 1;
}
Expand Down Expand Up @@ -1552,7 +1552,7 @@ static void dpiOci__loadLibOnWindows(const char *dllName)
temp = strrchr(moduleName, '\\');
if (temp) {
*(temp + 1) = '\0';
strncat(moduleName, dllName, sizeof(moduleName));
strncat(moduleName, dllName, sizeof(moduleName) - 1);
dpiOciLibHandle = LoadLibrary(moduleName);
}
}
Expand Down

0 comments on commit ccc448f

Please sign in to comment.