[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking |
Date: |
Mon, 12 Mar 2018 10:01:46 +0100 |
On Sun, 11 Mar 2018 20:12:39 +0000
Nia Alarie <address@hidden> wrote:
> Signed-off-by: Nia Alarie <address@hidden>
> ---
Applied, thanks.
> hw/9pfs/9p.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 48fa48e720..64f3bb976c 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -15,6 +15,7 @@
> #include <glib/gprintf.h>
> #include "hw/virtio/virtio.h"
> #include "qapi/error.h"
> +#include "qemu/cutils.h"
> #include "qemu/error-report.h"
> #include "qemu/iov.h"
> #include "qemu/sockets.h"
> @@ -2213,8 +2214,15 @@ static void coroutine_fn v9fs_create(void *opaque)
> }
> v9fs_path_copy(&fidp->path, &path);
> } else if (perm & P9_STAT_MODE_LINK) {
> - int32_t ofid = atoi(extension.data);
> - V9fsFidState *ofidp = get_fid(pdu, ofid);
> + long ofid;
> + V9fsFidState *ofidp;
> +
> + if (qemu_strtol(extension.data, NULL, 10, &ofid) ||
> + ofid > INT32_MAX || ofid < INT32_MIN) {
> + err = -EINVAL;
> + goto out;
> + }
> + ofidp = get_fid(pdu, (int32_t)ofid);
> if (ofidp == NULL) {
> err = -EINVAL;
> goto out;
- [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Nia Alarie, 2018/03/11
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking,
Greg Kurz <=
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Eric Blake, 2018/03/12
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Greg Kurz, 2018/03/12
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Daniel P . Berrangé, 2018/03/12
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Greg Kurz, 2018/03/12
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, nee, 2018/03/13
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Stefan Hajnoczi, 2018/03/13
- Re: [Qemu-devel] [PATCH] 9p: Convert use of atoi to qemu_strtol to allow error checking, Greg Kurz, 2018/03/13