Received: from eggs.gnu.org ([2001:4830:134:3::10]:47968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm6Nv-00088l-0j for qemu-devel@nongnu.org; Thu, 28 Nov 2013 13:32:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm6No-00010P-Qm for qemu-devel@nongnu.org; Thu, 28 Nov 2013 13:32:18 -0500 From: Markus Armbruster References: <1385658779-7529-1-git-send-email-lersek@redhat.com> Date: Thu, 28 Nov 2013 19:32:09 +0100 In-Reply-To: <1385658779-7529-1-git-send-email-lersek@redhat.com> (Laszlo Ersek's message of "Thu, 28 Nov 2013 18:12:59 +0100") Message-ID: <87eh6074ye.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] qemu_opts_parse(): always check return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org Laszlo Ersek writes: > qemu_opts_parse() can always return NULL, even if the QemuOptsList.desc in > question would be trivial to satisfy (eg. because it's empty). For > example: > > qemu_opts_parse() > opts_parse() > qemu_opts_create() > id_wellformed() > > In practice: > > $ .../qemu-system-x86_64 -acpitable id=3 > qemu-system-x86_64: -acpitable id=3: Parameter 'id' expects an identifier > ** > ERROR:vl.c:3491:main: assertion failed: (opts != NULL) > Aborted (core dumped) > > $ .../qemu-system-x86_64 -smbios id=3 > qemu-system-x86_64: -smbios id=3: Parameter 'id' expects an identifier > Segmentation fault (core dumped) > > I checked all qemu_opts_parse() invocations (and all drive_def() > invocations too, because it blindly forwards the former's retval). Only > the two above examples look problematic. > > Signed-off-by: Laszlo Ersek Your fix is fine. I didn't redo your search for other unsafe uses. Reviewed-by: Markus Armbruster