From patchwork Mon Jul 29 09:06:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Yang X-Patchwork-Id: 262698 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 972EC2C0109 for ; Mon, 29 Jul 2013 19:08:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752529Ab3G2JIx (ORCPT ); Mon, 29 Jul 2013 05:08:53 -0400 Received: from mail1.windriver.com ([147.11.146.13]:58727 "EHLO mail1.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515Ab3G2JIx (ORCPT ); Mon, 29 Jul 2013 05:08:53 -0400 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.14.5/8.14.3) with ESMTP id r6T98ouM003433 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 29 Jul 2013 02:08:51 -0700 (PDT) Received: from pek-hostel-vm06.wrs.com (128.224.153.176) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.2.342.3; Mon, 29 Jul 2013 02:08:48 -0700 From: Robert Yang To: CC: , , Subject: [PATCH 1/2] debugfs.c: the max length of debugfs argument is too short Date: Mon, 29 Jul 2013 17:06:24 +0800 Message-ID: <1375088785-30653-2-git-send-email-liezhi.yang@windriver.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375088785-30653-1-git-send-email-liezhi.yang@windriver.com> References: <1375088785-30653-1-git-send-email-liezhi.yang@windriver.com> MIME-Version: 1.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The max length of debugfs argument is 256 which is too short, the arguments are two paths, the PATH_MAX is 4096 according to /usr/include/linux/limits.h, so use BUFSIZ (which is 8192 on Linux systems), that's also what the ss library uses. Signed-off-by: Robert Yang Acked-by: Darren Hart --- debugfs/debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 2660218..a6bc932 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -37,6 +37,10 @@ extern char *optarg; #include "../version.h" #include "jfs_user.h" +#ifndef BUFSIZ +#define BUFSIZ 8192 +#endif + ss_request_table *extra_cmds; const char *debug_prog_name; int sci_idx; @@ -2311,7 +2315,7 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[]) static int source_file(const char *cmd_file, int ss_idx) { FILE *f; - char buf[256]; + char buf[BUFSIZ]; char *cp; int exit_status = 0; int retval;