mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 17:29:28 +03:00
(cpio_read_bin_head): fix unintended sign extension.
If c_filesizes[0] is greater than 0x7fff implicit sign extension will happen on bit shift. Found by Coverity. Coverity id #32611. Coverity id #32612. Signed-off-by: Andreas Mohr <and@gmx.li> Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d37dbcca4c
commit
f57e69ad29
@ -603,11 +603,12 @@ cpio_read_bin_head (struct vfs_class *me, struct vfs_s_super *super)
|
|||||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||||
st.st_rdev = u.buf.c_rdev;
|
st.st_rdev = u.buf.c_rdev;
|
||||||
#endif
|
#endif
|
||||||
st.st_size = (u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
|
st.st_size = ((off_t) u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
|
||||||
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
||||||
st.st_atim.tv_nsec = st.st_mtim.tv_nsec = st.st_ctim.tv_nsec = 0;
|
st.st_atim.tv_nsec = st.st_mtim.tv_nsec = st.st_ctim.tv_nsec = 0;
|
||||||
#endif
|
#endif
|
||||||
st.st_atime = st.st_mtime = st.st_ctime = (u.buf.c_mtimes[0] << 16) | u.buf.c_mtimes[1];
|
st.st_atime = st.st_mtime = st.st_ctime =
|
||||||
|
((time_t) u.buf.c_mtimes[0] << 16) | u.buf.c_mtimes[1];
|
||||||
|
|
||||||
return cpio_create_entry (me, super, &st, name);
|
return cpio_create_entry (me, super, &st, name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user