From patchwork Tue Aug 6 02:52:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 2839136 Return-Path: X-Original-To: patchwork-linux-btrfs@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 A08E9BF535 for ; Tue, 6 Aug 2013 02:53:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C71452020C for ; Tue, 6 Aug 2013 02:53:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D30DD20203 for ; Tue, 6 Aug 2013 02:53:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753523Ab3HFCxI (ORCPT ); Mon, 5 Aug 2013 22:53:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24034 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753224Ab3HFCxH (ORCPT ); Mon, 5 Aug 2013 22:53:07 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r762qwhi001583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Aug 2013 22:52:58 -0400 Received: from Liberator.local (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r762qvWe027203 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 5 Aug 2013 22:52:58 -0400 Message-ID: <52006509.1060207@redhat.com> Date: Mon, 05 Aug 2013 21:52:57 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: linux-btrfs CC: Miao Xie Subject: [PATCH] btrfs-progs: don't overrun "answer" array in cmds-chunk.c X-Enigmail-Version: 1.5.2 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 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 If an array is 5 chars in size: char answer[5]; and we write the 6th char (counting from 0)... answer[5] = '\0'; we get problems: cmds-chunk.c: In function 'ask_user.clone.0': cmds-chunk.c:1343: warning: array subscript is above array bounds Fix it... Signed-off-by: Eric Sandeen Reviewed-by: Miao Xie --- -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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/cmds-chunk.c b/cmds-chunk.c index 03314de..7c3257c 100644 --- a/cmds-chunk.c +++ b/cmds-chunk.c @@ -1340,7 +1340,7 @@ again: } i++; } - answer[5] = '\0'; + answer[4] = '\0'; __fpurge(stdin); if (strlen(answer) == 0) {