qga: check bytes count read by guest-file-read
commit141b197408ab398c4f474ac1a728ab316e921f2b
authorPrasad J Pandit <pjp@fedoraproject.org>
Wed, 13 Jun 2018 06:16:57 +0000 (13 11:46 +0530)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 3 Jul 2018 15:58:06 +0000 (3 10:58 -0500)
tree524055e648e01ad0e02cee0c6f1d1fe855a771bb
parent65650f0182c11a000d488a3b8e8e6ad071853f31
qga: check bytes count read by guest-file-read

While reading file content via 'guest-file-read' command,
'qmp_guest_file_read' routine allocates buffer of count+1
bytes. It could overflow for large values of 'count'.
Add check to avoid it.

Reported-by: Fakhri Zulkifli <mohdfakhrizulkifli@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands-posix.c
qga/commands-win32.c