Received: from eggs.gnu.org ([2001:4830:134:3::10]:48052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVCv1-0004K0-TJ for qemu-devel@nongnu.org; Fri, 07 Dec 2018 04:59:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVCux-0003LN-UF for qemu-devel@nongnu.org; Fri, 07 Dec 2018 04:59:35 -0500 From: Markus Armbruster References: <20181206151856.77503-1-eblake@redhat.com> Date: Fri, 07 Dec 2018 10:59:28 +0100 In-Reply-To: <20181206151856.77503-1-eblake@redhat.com> (Eric Blake's message of "Thu, 6 Dec 2018 09:18:56 -0600") Message-ID: <87pnudzmgv.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] cutils: Assert in-range base for string-to-integer conversions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org, vsementsov@virtuozzo.com Eric Blake writes: > POSIX states that the value of endptr is unspecified if strtol() > fails with EINVAL due to an invalid base argument. Since none of > the callers to check_strtox_error() initialized endptr, we could > end up propagating uninitialized data back to a caller on error. > However, passing an out-of-range base is already a sign of poor > programming, so let's just assert that base is in range, at which > point check_strtox_error() can be tightened to assert that it is > receiving an initialized ep that points somewhere within the > caller's original string, regardless of whether strto*() succeeded > or failed with ERANGE. > > Reported-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster