[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer |
Date: |
Thu, 28 Jan 2016 13:52:32 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
Ping?
26.01.2016 12:36, Michael Tokarev wrote:
> 18.01.2016 17:23, Markus Armbruster wrote:
> [...]
>> Applied to my monitor-next with these tweaks:
>>
>> diff --git a/hmp.c b/hmp.c
>> index 8be03df..9c571f5 100644
>> --- a/hmp.c
>> +++ b/hmp.c
>> @@ -1739,7 +1739,7 @@ void hmp_sendkey(Monitor *mon, const QDict *qdict)
>> keyname_len = separator ? separator - keys : strlen(keys);
>>
>> /* Be compatible with old interface, convert user inputted "<" */
>> - if (!strncmp(keys, "<", 1) && keyname_len == 1) {
>> + if (keys[0] == '<' && keyname_len == 1) {
>> keys = "less";
>> keyname_len = 4;
>> }
>> @@ -1758,7 +1758,8 @@ void hmp_sendkey(Monitor *mon, const QDict *qdict)
>> if (strstart(keys, "0x", NULL)) {
>> char *endp;
>> int value = strtoul(keys, &endp, 0);
>> - if (*endp != '\0' && *endp != '-') {
>> + assert(endp <= keys + keyname_len);
>> + if (endp != keys + keyname_len) {
>> goto err_out;
>> }
>> keylist->value->type = KEY_VALUE_KIND_NUMBER;
>
> Marcus, where's your monitor-next branch? Repository at
> git://repo.or.cz/qemu/armbru.git , monitor-next branch does
> not contain this change, last commit to hmp.c dated Sep-8.
>
> Thanks,
>
> /mjt
>
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, (continued)
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Markus Armbruster, 2016/01/12
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Wolfgang Bumiller, 2016/01/12
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Markus Armbruster, 2016/01/12
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Wolfgang Bumiller, 2016/01/12
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Markus Armbruster, 2016/01/12
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Wolfgang Bumiller, 2016/01/13
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Markus Armbruster, 2016/01/18
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Wolfgang Bumiller, 2016/01/18
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Markus Armbruster, 2016/01/18
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Michael Tokarev, 2016/01/26
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer,
Michael Tokarev <=
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, Markus Armbruster, 2016/01/28