qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/9] hw/core/qdev-properties: Use qemu_strtol() in set_mac()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 1/9] hw/core/qdev-properties: Use qemu_strtol() in set_mac() handler
Date: Sun, 15 Mar 2020 23:28:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/15/20 10:25 PM, Richard Henderson wrote:
On 3/13/20 11:45 AM, Philippe Mathieu-Daudé wrote:
+        if (qemu_strtol(str + pos, &p, 16, &val) < 0 || val > 0xff) {
+            goto inval;
+        }

This is doing more that *just* using qemu_strtol, it's also validating the
input.  I don't think you need to adjust the patch, just improve the commit
message.  With that,

Reviewed-by: Richard Henderson <address@hidden>

Correct. I'll add a comment, as currently we ignore incorrect input due to the implicit cast to uint8_t:

struct MACAddr {
    uint8_t a[6];
};

    mac->a[i] = strtol(str+pos, &p, 16);

Thanks!


r~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]