qemu-io: better input validation for vector-based commands
authorChristoph Hellwig <hch@lst.de>
Fri, 10 Jul 2009 11:33:42 +0000 (13:33 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 10 Jul 2009 17:25:36 +0000 (12:25 -0500)
commit41f16946353f7948d728abb43bede9400a31ec41
tree41b562b598b46c29a3c33a9839debe73a1588850
parenteb8ec3cf7e68403ee87f381300a9339a9757efa6
qemu-io: better input validation for vector-based commands

Fix up a couple of issues with validating the input of the various
length arguments for the vectored I/O commands:

 - do the alignment check on each length instead the always 0 count argument
 - use a long long varibale for the cvtnum return value so that we can check
   wether it wasn't a number
 - check for a too large argument instead of truncating it

Also refactor it into a common helper for all four calers and avoid parsing
the numbers twice.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
qemu-io.c