From patchwork Wed Dec 11 18:35:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 3327611 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C3259F37A for ; Wed, 11 Dec 2013 18:48:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49D4B20636 for ; Wed, 11 Dec 2013 18:48:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AFED2054C for ; Wed, 11 Dec 2013 18:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750922Ab3LKSsQ (ORCPT ); Wed, 11 Dec 2013 13:48:16 -0500 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:50705 "EHLO alan.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750800Ab3LKSsQ (ORCPT ); Wed, 11 Dec 2013 13:48:16 -0500 X-Greylist: delayed 791 seconds by postgrey-1.27 at vger.kernel.org; Wed, 11 Dec 2013 13:48:15 EST Received: from alan.etchedpixels.co.uk (localhost [127.0.0.1]) by alan.etchedpixels.co.uk (8.14.4/8.14.4/Debian-2.1ubuntu4) with ESMTP id rBBIZEtL009204 for ; Wed, 11 Dec 2013 18:35:15 GMT Subject: [PATCH] cpufreq: Fix sscanf robustness To: linux-pm@vger.kernel.org From: Alan Date: Wed, 11 Dec 2013 18:35:14 +0000 Message-ID: <20131211183506.9179.83721.stgit@alan.etchedpixels.co.uk> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The cpufreq-set tool has a missing length check. This is basically just correctness but still should get fixed. One of a set of sscanf problems reported by Jackie Chang Signed-off-by: Alan Cox Acked-by: Viresh Kumar --- tools/power/cpupower/utils/cpufreq-set.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index dd1539e..a416de8 100644 --- a/tools/power/cpupower/utils/cpufreq-set.c +++ b/tools/power/cpupower/utils/cpufreq-set.c @@ -257,7 +257,7 @@ int cmd_freq_set(int argc, char **argv) print_unknown_arg(); return -EINVAL; } - if ((sscanf(optarg, "%s", gov)) != 1) { + if ((sscanf(optarg, "%19s", gov)) != 1) { print_unknown_arg(); return -EINVAL; }