mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-01 00:54:24 +03:00
* tar.c (tar_read_header): Fix missed *.
* extfs.c (extfs_readlink): Revert last change: readlink does not append a NUL character to buf. * ftpfs.c: Warning fix. * vfs-impl.h (struct vfs_class.readlink): Make "size" size_t. Adjust all callers.
This commit is contained in:
parent
c44a4a4c31
commit
e04694309c
10
vfs/extfs.c
10
vfs/extfs.c
@ -974,13 +974,13 @@ static int extfs_fstat (void *data, struct stat *buf)
|
||||
}
|
||||
|
||||
static int
|
||||
extfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
extfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q;
|
||||
size_t len;
|
||||
struct entry *entry;
|
||||
char *mpath = g_strdup(path);
|
||||
char *mpath = g_strdup (path);
|
||||
int result = -1;
|
||||
|
||||
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
||||
@ -993,8 +993,10 @@ extfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
goto cleanup;
|
||||
}
|
||||
len = strlen (entry->inode->linkname);
|
||||
result = len > (size - 1) ? size - 1 : len;
|
||||
g_strlcpy (buf, entry->inode->linkname, result + 1);
|
||||
if (size < len)
|
||||
len = size;
|
||||
/* readlink() does not append a NUL character to buf */
|
||||
memcpy (buf, entry->inode->linkname, result = len);
|
||||
cleanup:
|
||||
g_free (mpath);
|
||||
return result;
|
||||
|
@ -1669,7 +1669,8 @@ ftpfs_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
}
|
||||
|
||||
static char buffer[BUF_MEDIUM];
|
||||
static char *netrc, *netrcp;
|
||||
static char *netrc;
|
||||
static const char *netrcp;
|
||||
|
||||
/* This should match the keywords[] array below */
|
||||
typedef enum {
|
||||
|
@ -410,7 +410,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive,
|
||||
char *bp, *data;
|
||||
int size, written;
|
||||
|
||||
if (h_size > MC_MAXPATHLEN) {
|
||||
if (*h_size > MC_MAXPATHLEN) {
|
||||
message (1, MSG_ERROR, _("Inconsistent tar archive"));
|
||||
return STATUS_BADCHECKSUM;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ struct vfs_class {
|
||||
struct utimbuf * times);
|
||||
|
||||
int (*readlink) (struct vfs_class *me, const char *path, char *buf,
|
||||
int size);
|
||||
size_t size);
|
||||
int (*symlink) (struct vfs_class *me, const char *n1, const char *n2);
|
||||
int (*link) (struct vfs_class *me, const char *p1, const char *p2);
|
||||
int (*unlink) (struct vfs_class *me, const char *path);
|
||||
|
Loading…
Reference in New Issue
Block a user