All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer
Date: Tue, 26 Jan 2016 12:36:46 +0300	[thread overview]
Message-ID: <56A73E2E.4000906@msgid.tls.msk.ru> (raw)
In-Reply-To: <87oacjklvb.fsf@blackfin.pond.sub.org>

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

  reply	other threads:[~2016-01-26  9:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 12:40 [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer P J P
2015-12-18  3:46 ` 刘令
2015-12-18  4:34   ` P J P
2015-12-22 18:48 ` Luiz Capitulino
2016-01-12  8:41   ` Markus Armbruster
2016-01-08  9:19 ` Wolfgang Bumiller
2016-01-08 12:19   ` P J P
2016-01-08 13:02     ` Wolfgang Bumiller
2016-01-08 13:59       ` P J P
2016-01-08 14:38         ` Wolfgang Bumiller
2016-01-08 17:32           ` P J P
2016-01-09  9:31             ` Wolfgang Bumiller
2016-01-09 13:03               ` P J P
2016-01-10  7:56                 ` Michael Tokarev
2016-01-11  7:00                   ` P J P
2016-01-11  7:59                   ` Wolfgang Bumiller
2016-01-11  8:22                     ` P J P
2016-01-12  8:45                     ` Markus Armbruster
2016-01-12  9:27                       ` Wolfgang Bumiller
2016-01-12 16:00                         ` Markus Armbruster
2016-01-12 16:25                           ` Wolfgang Bumiller
2016-01-12 16:52                             ` Markus Armbruster
2016-01-13  8:09                               ` Wolfgang Bumiller
2016-01-18 13:02                                 ` Markus Armbruster
2016-01-18 13:38                                   ` Wolfgang Bumiller
2016-01-18 14:23                                     ` Markus Armbruster
2016-01-26  9:36                                       ` Michael Tokarev [this message]
2016-01-28 10:52                                         ` Michael Tokarev
2016-01-28 14:45                                           ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A73E2E.4000906@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.