mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 07:45:17 +00:00
fdinfo: Sanitize types in fdinfo_entry
The namelen is u16, to cover the PATH_MAX u8 is not enough. The pos is u64, since file offset is that long indeed. The id is u32 as per previous patch. Fix printf-s respectively. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -83,8 +83,8 @@ static void show_files(int fd_files)
|
|||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
pr_msg("type: %s flags: %4x pos: %8x "
|
pr_msg("type: %s flags: %4x pos: %lx "
|
||||||
"addr: %16lx id: %8lx",
|
"addr: %16lx id: %8x",
|
||||||
fdtype2s(e.type), e.flags, e.pos, e.addr, e.id);
|
fdtype2s(e.type), e.flags, e.pos, e.addr, e.id);
|
||||||
|
|
||||||
if (e.len) {
|
if (e.len) {
|
||||||
|
2
files.c
2
files.c
@@ -76,7 +76,7 @@ static int collect_fd(int pid, struct fdinfo_entry *e)
|
|||||||
struct fdinfo_list_entry *le = &fdinfo_list[nr_fdinfo_list];
|
struct fdinfo_list_entry *le = &fdinfo_list[nr_fdinfo_list];
|
||||||
struct fdinfo_desc *desc;
|
struct fdinfo_desc *desc;
|
||||||
|
|
||||||
pr_info("Collect fdinfo pid=%d fd=%ld id=%16lx\n",
|
pr_info("Collect fdinfo pid=%d fd=%ld id=%16x\n",
|
||||||
pid, e->addr, e->id);
|
pid, e->addr, e->id);
|
||||||
|
|
||||||
nr_fdinfo_list++;
|
nr_fdinfo_list++;
|
||||||
|
@@ -46,11 +46,11 @@ enum fd_types {
|
|||||||
|
|
||||||
struct fdinfo_entry {
|
struct fdinfo_entry {
|
||||||
u8 type;
|
u8 type;
|
||||||
u8 len;
|
u16 len;
|
||||||
u16 flags;
|
u16 flags;
|
||||||
u32 pos;
|
u64 pos;
|
||||||
u64 addr;
|
u64 addr;
|
||||||
u64 id;
|
u32 id;
|
||||||
u8 name[0];
|
u8 name[0];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user