From patchwork Thu Jun 6 16:27:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 249476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B7AD42C00A6 for ; Fri, 7 Jun 2013 02:30:49 +1000 (EST) Received: from localhost ([::1]:42176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukd5L-0003Mn-OZ for incoming@patchwork.ozlabs.org; Thu, 06 Jun 2013 12:30:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukd2E-0006RR-Ff for qemu-devel@nongnu.org; Thu, 06 Jun 2013 12:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ukd2B-00073y-Jy for qemu-devel@nongnu.org; Thu, 06 Jun 2013 12:27:34 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:41775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukd2B-00073e-BS for qemu-devel@nongnu.org; Thu, 06 Jun 2013 12:27:31 -0400 Received: from blackfin.pond.sub.org (p5B32B146.dip0.t-ipconnect.de [91.50.177.70]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 57A35A62D8; Thu, 6 Jun 2013 18:27:28 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0AF57200BA; Thu, 6 Jun 2013 18:27:27 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 6 Jun 2013 18:27:26 +0200 Message-Id: <1370536046-15125-8-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1370536046-15125-1-git-send-email-armbru@redhat.com> References: <1370536046-15125-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:4f8:121:10e4::3 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 7/7] smbios: Check R in -smbios type=0, release=R parses okay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Laszlo Ersek --- hw/i386/smbios.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c index 68bd6d0..88a1360 100644 --- a/hw/i386/smbios.c +++ b/hw/i386/smbios.c @@ -140,7 +140,10 @@ static void smbios_build_type_0_fields(const char *t) bios_release_date_str), buf, strlen(buf) + 1); if (get_param_value(buf, sizeof(buf), "release", t)) { - sscanf(buf, "%hhd.%hhd", &major, &minor); + if (sscanf(buf, "%hhd.%hhd", &major, &minor) != 2) { + error_report("Invalid release"); + exit(1); + } smbios_add_field(0, offsetof(struct smbios_type_0, system_bios_major_release), &major, 1);