1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

The rmt client in GNU cpio could have a heap overflow when a malicious

remote tape service returns deliberately crafted packets containing
more data than requested.

Fix this by checking the returned amount of data and bail out when it
is more than what we requested.

PR:		gnu/145010
Submitted by:	naddy
Reviewed by:	imp
MFC after:	immediately
Security:	CVE-2010-0624
This commit is contained in:
Xin LI 2010-03-25 20:02:54 +00:00
parent bb6ba5f6b9
commit 780179e871
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205654

View File

@ -570,7 +570,8 @@ rmt_read__ (int handle, char *buffer, size_t length)
sprintf (command_buffer, "R%lu\n", (unsigned long) length);
if (do_command (handle, command_buffer) == -1
|| (status = get_status (handle)) == SAFE_READ_ERROR)
|| (status = get_status (handle)) == SAFE_READ_ERROR
|| status > length)
return SAFE_READ_ERROR;
for (counter = 0; counter < status; counter += rlen, buffer += rlen)