From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOkBt-0000K5-1e for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:52:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOkBp-0004rJ-Iu for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:52:40 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:60592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOkBp-0004qk-BB for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:52:37 -0500 References: <56920EC7.6090109@msgid.tls.msk.ru> <20160111075914.GA28466@olga> <87wprfqj8t.fsf@blackfin.pond.sub.org> <1786291473.38.33445737-8c34-4632-b55f-f565652bb5d3.open-xchange@webmail.proxmox.com> <87h9iirdms.fsf@blackfin.pond.sub.org> <1388889179.80.33445737-8c34-4632-b55f-f565652bb5d3.open-xchange@webmail.proxmox.com> <877fjepwo9.fsf@blackfin.pond.sub.org> <20160113080958.GA18934@olga> <87io2rnir4.fsf@blackfin.pond.sub.org> <20160118133819.GA29453@olga> <87oacjklvb.fsf@blackfin.pond.sub.org> <56A73E2E.4000906@msgid.tls.msk.ru> From: Michael Tokarev Message-ID: <56A9F2F0.5060005@msgid.tls.msk.ru> Date: Thu, 28 Jan 2016 13:52:32 +0300 MIME-Version: 1.0 In-Reply-To: <56A73E2E.4000906@msgid.tls.msk.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hmp: avoid redundant null termination of buffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org 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 >