HDFS-15922. Use memcpy for copying non-null terminated string. (#2827)

This commit is contained in:
Gautham B A 2021-03-29 23:08:59 +05:30 committed by GitHub
parent ea6595d3b6
commit 6a3e135316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ static void init_protectedpaths(dfs_context *dfs)
}
dfs->protectedpaths[j] = (char*)malloc(sizeof(char)*length+1);
assert(dfs->protectedpaths[j]);
strncpy(dfs->protectedpaths[j], tmp, length);
memcpy(dfs->protectedpaths[j], tmp, length);
dfs->protectedpaths[j][length] = '\0';
if (eos) {
tmp = eos + 1;

View File

@ -58,7 +58,7 @@ void permission_disp(short permissions, char *rtr) {
default:
perm = "???";
}
strncpy(rtr, perm, 3);
memcpy(rtr, perm, 3);
rtr+=3;
}
}