From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrSA5-0008Fu-Uh for qemu-devel@nongnu.org; Fri, 13 Dec 2013 07:48:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrS9y-0007xs-Jl for qemu-devel@nongnu.org; Fri, 13 Dec 2013 07:48:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrS9y-0007xb-Bj for qemu-devel@nongnu.org; Fri, 13 Dec 2013 07:48:02 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBDCm1v7030180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Dec 2013 07:48:01 -0500 Message-ID: <1386938878.8306.16.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Fri, 13 Dec 2013 13:47:58 +0100 In-Reply-To: <52AB0028.407@redhat.com> References: <1386929311-520-1-git-send-email-kraxel@redhat.com> <52AB0028.407@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] inet_listen_opts: add error checking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org Hi, > parse_uint_full takes an 'unsigned long long *', but you are passing an > 'int *'. I'm surprised it compiled for you. It causes a buffer > overflow if the pointer is assigned to, and gives different results > depending on platform endianness. Fixed in v4. > > + error_setg(errp, "can't convert to a number: %s", port); > > + return -1; > > + } > > + if (baseport < 0 || baseport + port_offset > 65535) { > > + error_setg(errp, "port %s out of range", port); > > But errno is not set to a sane value at this point, so error_setg() is > wrong. That would be true for error_setg_errno()- cheers, Gerd