From patchwork Thu Apr 29 13:58:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Lovenberg X-Patchwork-Id: 51297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 81EB7B7BEE for ; Thu, 29 Apr 2010 23:58:32 +1000 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id EB39F4658D; Thu, 29 Apr 2010 07:58:31 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=3.8 tests=AWL, BAYES_00, NO_MORE_FUNN, SPF_PASS autolearn=no version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mail-vw0-f41.google.com (mail-vw0-f41.google.com [209.85.212.41]) by lists.samba.org (Postfix) with ESMTP id 92C6CAD226 for ; Thu, 29 Apr 2010 07:58:26 -0600 (MDT) Received: by mail-vw0-f41.google.com with SMTP id 12so1445583vws.14 for ; Thu, 29 Apr 2010 06:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:content-type :content-transfer-encoding; bh=t1y4z8z/5prBgs/WtawsmWbdszBK9whQkI5YqD85vQE=; b=oeY6qgkLY+D/R30XTnh3ohjjqBou6AmSWmSywgrsZCkHKju3tXmKahpFf6Oq/3m17W 1ONuIV+LtDjWUlFsCXrOI5ZrzfwXJx7D9ovzMmqq0G0McLNTv3s2OW0UpDjdMTANmTyn 9Clkox5gRwxuYM7MhbVFNAO/js59puc33f7Ic= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :content-type:content-transfer-encoding; b=J7gFN+QYrF+dGEHck63/HmDtO6oHlFzDuHogQEqqCdnJTxX00IugKzBgkGnT5nPDHH I/ADTEc4Vg5Ibm1ZwtUA7j3AoKM7vYK10xa6XTemMxxUDJbeMyiUfFuWVTmd7LhpMqVd xY9fXIdRV5vAV63g887IkYtPyRMpyn4rRVq1w= Received: by 10.224.29.75 with SMTP id p11mr2643225qac.167.1272549501416; Thu, 29 Apr 2010 06:58:21 -0700 (PDT) Received: from localhost.localdomain (24.115.161.116.res-cmts.flt.ptd.net [24.115.161.116]) by mx.google.com with ESMTPS id 26sm1606397qwa.2.2010.04.29.06.58.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Apr 2010 06:58:20 -0700 (PDT) From: Scott Lovenberg To: linux-cifs-client@lists.samba.org Date: Thu, 29 Apr 2010 09:58:17 -0400 Message-Id: <1272549497-6578-2-git-send-email-scott.lovenberg@gmail.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1272549497-6578-1-git-send-email-scott.lovenberg@gmail.com> References: <1272549497-6578-1-git-send-email-scott.lovenberg@gmail.com> Cc: jlayton@samba.org Subject: [linux-cifs-client] [PATCH] Removed magic number for max username in parse_options. X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Replaced max username in parse_options with the sum of its potential parts for "domain/user%password" formatted values. Note that forward slashes still expand to a double back slash in the parse_username function, though. Signed-off-by: Scott Lovenberg --- mount.cifs.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/mount.cifs.c b/mount.cifs.c index 155d594..c1944ac 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -858,7 +858,11 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) return EX_USAGE; } } else { - if (strnlen(value, 260) >= 260) { + /* domain/username%password */ + const int max = MAX_DOMAIN_SIZE + + MAX_USERNAME_SIZE + + MOUNT_PASSWD_SIZE + 2; + if (strnlen(value, max + 1) >= max + 1) { fprintf(stderr, "username too long\n"); return EX_USAGE; }