From patchwork Fri Aug 22 13:18:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 4763791 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B51C8C0338 for ; Fri, 22 Aug 2014 13:18:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B66F720158 for ; Fri, 22 Aug 2014 13:18:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AAE320172 for ; Fri, 22 Aug 2014 13:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756218AbaHVNSZ (ORCPT ); Fri, 22 Aug 2014 09:18:25 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:44543 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756122AbaHVNSW (ORCPT ); Fri, 22 Aug 2014 09:18:22 -0400 Received: by mail-ig0-f174.google.com with SMTP id c1so14922937igq.7 for ; Fri, 22 Aug 2014 06:18:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JxU7F1ih/kuHi5xxwO/+CdDaja0GZgsH4X/08q3RgRY=; b=J/H+XxiCRH7qIjsvzZMqqs40c0avJlop+eccV+UEKO47BSIm8FXlMlkVhqlmloNnrz X+ms+3BSkU4pNhJX8YUKfaLpfVjRqkRkkX7+mgcHrLrH4L3RnsoQnx2KcA9A5Uc53Fp6 i/k+LooxvmZuDzmb+f9HBk9hoGZH/XDlivPyxZBS6UADiPFa2HHucygRhJGXsSrYGpA4 ncnuerxWzhzfQWHU1SFkQcDAVI4HYoZ9wvXq/VRMP3+A+86kIJFb5vflylya90j+nyH1 sX+TlDRelZxiBDHs9PxpghxsuWP2TtPstDEQLh29NpTvZuwa+NeFUHF+YVlR/bXP/Wof 6xLA== X-Gm-Message-State: ALoCoQmTy62SXruuXJyv2rhEniyl9q7BH4ckGhGexKFqpAAcbYiHcqfYc5EvY4a1sbkDhZzvMzO4 X-Received: by 10.50.79.197 with SMTP id l5mr11335634igx.12.1408713501537; Fri, 22 Aug 2014 06:18:21 -0700 (PDT) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by mx.google.com with ESMTPSA id os8sm29806198igb.9.2014.08.22.06.18.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Aug 2014 06:18:20 -0700 (PDT) Received: from bob by hash with local (Exim 4.80) (envelope-from ) id 1XKojG-00024Z-0A; Fri, 22 Aug 2014 09:18:06 -0400 From: Bob Copeland To: linville@tuxdriver.com, mickflemm@gmail.com Cc: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org, Bob Copeland Subject: [PATCH 2/3] ath5k: ensure led name is null terminated Date: Fri, 22 Aug 2014 09:18:01 -0400 Message-Id: <1408713482-7917-2-git-send-email-me@bobcopeland.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1408713482-7917-1-git-send-email-me@bobcopeland.com> References: <1408713482-7917-1-git-send-email-me@bobcopeland.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Add the missing null termination after strncpy(). This isn't actually a buffer overflow in this case since we use snprintf() appropriately to fill the buffer passed by the caller, but in the interest of not turning this into a bug down the road, go ahead and force termination here. Found by Coverity. Signed-off-by: Bob Copeland --- drivers/net/wireless/ath/ath5k/led.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c index f77ef36..edc32ea 100644 --- a/drivers/net/wireless/ath/ath5k/led.c +++ b/drivers/net/wireless/ath/ath5k/led.c @@ -130,6 +130,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led, led->ah = ah; strncpy(led->name, name, sizeof(led->name)); + led->name[sizeof(led->name)-1] = 0; led->led_dev.name = led->name; led->led_dev.default_trigger = trigger; led->led_dev.brightness_set = ath5k_led_brightness_set;