HDFS-15922. Use memcpy for copying non-null terminated string in jni_helper.c (#2818)
This commit is contained in:
parent
19e418c10d
commit
1fed18bb2d
|
@ -422,9 +422,9 @@ static ssize_t wildcard_expandPath(const char* path, char* expanded)
|
|||
|
||||
if (expanded != NULL) {
|
||||
// pathLength includes an extra '.'
|
||||
strncpy(dest, path, pathLength-1);
|
||||
memcpy(dest, path, pathLength - 1);
|
||||
dest += pathLength - 1;
|
||||
strncpy(dest, filename, filenameLength);
|
||||
memcpy(dest, filename, filenameLength);
|
||||
dest += filenameLength;
|
||||
*dest = PATH_SEPARATOR;
|
||||
dest++;
|
||||
|
@ -536,7 +536,7 @@ static ssize_t getClassPath_helper(const char *classpath, char* expandedClasspat
|
|||
// +1 for path separator or null terminator
|
||||
length += tokenlen + 1;
|
||||
if (expandedCP_curr != NULL) {
|
||||
strncpy(expandedCP_curr, cp_token, tokenlen);
|
||||
memcpy(expandedCP_curr, cp_token, tokenlen);
|
||||
expandedCP_curr += tokenlen;
|
||||
*expandedCP_curr = PATH_SEPARATOR;
|
||||
expandedCP_curr++;
|
||||
|
|
Loading…
Reference in New Issue