|
From: | Panxidong |
Subject: | CPIO Bug Report of cpio-2.13--Integer Overflow |
Date: | Wed, 21 Apr 2021 04:04:05 +0000 |
Q1: If the file size > 2G, the following code will be overflow even in 64-Bit system. The type of start_of_block is
int, it’s too short,
should use
off_t / long. If you wish to send a bug report, a feature request, or simply to share your thoughts about GNU cpio, please write to
<bug-cpio@gnu.org>. "cpio-2.13/src/util.c" void prepare_append (int out_file_des) {
int
start_of_header;
int start_of_block;
int
useful_bytes_in_block; char *tmp_buf; start_of_header = last_header_start; /* Figure out how many bytes we will rewrite, and where they start. */ useful_bytes_in_block = start_of_header % io_block_size;
start_of_block = start_of_header - useful_bytes_in_block; if (lseek (out_file_des, start_of_block, SEEK_SET) < 0) error (PAXEXIT_FAILURE, errno, _("cannot seek on output")); if (useful_bytes_in_block > 0) { tmp_buf = (char *) xmalloc (useful_bytes_in_block); read (out_file_des, tmp_buf, useful_bytes_in_block); if (lseek (out_file_des, start_of_block, SEEK_SET) < 0) error (PAXEXIT_FAILURE, errno, _("cannot seek on output")); ******************************************************************************************************** 禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。 如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! 本邮件及其附件含有新华三集团的保密信息,仅限于发送给上面地址中列出 的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、 或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本 邮件! This e-mail and its attachments contain confidential information from New H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! |
[Prev in Thread] | Current Thread | [Next in Thread] |