gfapi: fix potential non-0-terminated string (CID 1134002)
Use correct target buffer length for strncpy and make sure that the target string is 0 terminated. Fixes Coverity ID 1134002. Change-Id: I97a74a94a818eb08a711e547f2ac6ae46087f065 BUG: 789278 Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-on: http://review.gluster.org/10247 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
7fb85e3670
commit
fc451b5b0f
@ -2062,7 +2062,8 @@ gf_dirent_to_dirent (gf_dirent_t *gf_dirent, struct dirent *dirent)
|
||||
dirent->d_namlen = strlen (gf_dirent->d_name);
|
||||
#endif
|
||||
|
||||
strncpy (dirent->d_name, gf_dirent->d_name, GF_NAME_MAX + 1);
|
||||
strncpy (dirent->d_name, gf_dirent->d_name, NAME_MAX);
|
||||
dirent->d_name[NAME_MAX] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user