mirror of https://github.com/MidnightCommander/mc
* direntry.c: Use g_strlcpy instead strncpy for fix buffer overrun
* extfs.c: Likewise. * mcfs.c: Likewise. * smbfs.c: Likewise. * utilvfs.c: Likewise.
This commit is contained in:
parent
c64cec997a
commit
a2d1d4e8dc
|
@ -1,3 +1,11 @@
|
|||
2004-08-26 Pavel S. Shirshov <pavelsh@mail.ru>
|
||||
|
||||
* direntry.c: Use g_strlcpy instead strncpy for fix buffer overrun
|
||||
* extfs.c: Likewise.
|
||||
* mcfs.c: Likewise.
|
||||
* smbfs.c: Likewise.
|
||||
* utilvfs.c: Likewise.
|
||||
|
||||
2004-08-26 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* vfs.c (mc_chdir): Fixed memory leak.
|
||||
|
|
|
@ -607,8 +607,7 @@ vfs_s_readdir(void *data)
|
|||
return NULL;
|
||||
|
||||
if (info->cur->name) {
|
||||
strncpy(dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
|
||||
dir.dent.d_name[MC_MAXPATHLEN] = 0;
|
||||
g_strlcpy (dir.dent.d_name, info->cur->name, MC_MAXPATHLEN);
|
||||
} else {
|
||||
vfs_die("Null in structure-cannot happen");
|
||||
}
|
||||
|
|
|
@ -892,8 +892,7 @@ static void * extfs_readdir(void *data)
|
|||
if (!*info)
|
||||
return NULL;
|
||||
|
||||
strncpy(dir.dent.d_name, (*info)->name, MC_MAXPATHLEN);
|
||||
dir.dent.d_name[MC_MAXPATHLEN] = 0;
|
||||
g_strlcpy(dir.dent.d_name, (*info)->name, MC_MAXPATHLEN);
|
||||
|
||||
compute_namelen(&dir.dent);
|
||||
*info = (*info)->next_in_dir;
|
||||
|
|
|
@ -756,8 +756,7 @@ mcfs_readdir (void *info)
|
|||
return NULL;
|
||||
}
|
||||
dirent_dest = mcfs_readdir_data.dent.d_name;
|
||||
strncpy (dirent_dest, mcfs_info->current->text, MC_MAXPATHLEN);
|
||||
dirent_dest[MC_MAXPATHLEN] = 0;
|
||||
g_strlcpy (dirent_dest, mcfs_info->current->text, MC_MAXPATHLEN);
|
||||
cached_lstat_info = &mcfs_info->current->my_stat;
|
||||
mcfs_info->current = mcfs_info->current->next;
|
||||
|
||||
|
|
|
@ -803,8 +803,7 @@ smbfs_readdir(void *info)
|
|||
#endif
|
||||
return NULL;
|
||||
}
|
||||
strncpy(dirent_dest, smbfs_info->current->text, MC_MAXPATHLEN);
|
||||
dirent_dest[MC_MAXPATHLEN] = 0;
|
||||
g_strlcpy(dirent_dest, smbfs_info->current->text, MC_MAXPATHLEN);
|
||||
smbfs_info->current = smbfs_info->current->next;
|
||||
|
||||
compute_namelen(&smbfs_readdir_data.dent);
|
||||
|
|
|
@ -160,7 +160,7 @@ vfs_finduid (const char *uname)
|
|||
|
||||
if (uname[0] != saveuname[0] /* Quick test w/o proc call */
|
||||
||0 != strncmp (uname, saveuname, TUNMLEN)) {
|
||||
strncpy (saveuname, uname, TUNMLEN);
|
||||
g_strlcpy (saveuname, uname, TUNMLEN);
|
||||
pw = getpwnam (uname);
|
||||
if (pw) {
|
||||
saveuid = pw->pw_uid;
|
||||
|
@ -182,7 +182,7 @@ vfs_findgid (const char *gname)
|
|||
|
||||
if (gname[0] != savegname[0] /* Quick test w/o proc call */
|
||||
||0 != strncmp (gname, savegname, TUNMLEN)) {
|
||||
strncpy (savegname, gname, TUNMLEN);
|
||||
g_strlcpy (savegname, gname, TUNMLEN);
|
||||
gr = getgrnam (gname);
|
||||
if (gr) {
|
||||
savegid = gr->gr_gid;
|
||||
|
|
Loading…
Reference in New Issue