[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer |
Date: |
Thu, 28 Jan 2016 15:45:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Michael Tokarev <address@hidden> writes:
> Ping?
Sorry for the delay, I've been focusing on the QAPI queue to the
exclusion of pretty much everything else.
> 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.
I forgot to push. Should be there now, but needs a rebase to current
master.
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer, (continued)
- 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, 2016/01/28
- Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer,
Markus Armbruster <=