From: David Disseldorp <ddiss@suse.de>
To: linux-cifs@vger.kernel.org
Cc: Steve French <smfrench@gmail.com>, David Disseldorp <ddiss@suse.de>
Subject: [PATCH 2/3] mount.cifs: adjust get_password_from_file() buf size
Date: Tue, 31 Mar 2026 11:37:52 +1100 [thread overview]
Message-ID: <20260331012508.17410-3-ddiss@suse.de> (raw)
In-Reply-To: <20260331012508.17410-1-ddiss@suse.de>
The parsed_mount_info password and password2 fields are both zero
terminated and sized MOUNT_PASSWD_SIZE + 1.
The get_password_from_file() buf adds one to this size, presumably to
account for (extra) zero termination. This is unnecessary, so use a
consistent size across all buffers.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
mount.cifs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mount.cifs.c b/mount.cifs.c
index d41ca6a..945196f 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -684,7 +684,7 @@ get_password_from_file(int file_descript, char *filename,
int is_pass2 = which_pass == OPT_PASS2;
unsigned int pass_length = is_pass2 ?
sizeof(parsed_info->password2) : sizeof(parsed_info->password);
- char buf[pass_length + 1];
+ char buf[pass_length];
if (filename != NULL) {
rc = toggle_dac_capability(0, 1);
--
2.51.0
next prev parent reply other threads:[~2026-03-31 1:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 0:37 [PATCH 0/3] mount.cifs: minor buflen tracking cleanups David Disseldorp
2026-03-31 0:37 ` [PATCH 1/3] build_assert: add ccan build_assert.h header David Disseldorp
2026-03-31 0:37 ` David Disseldorp [this message]
2026-03-31 0:37 ` [PATCH 3/3] mount.cifs: remove runtime pass_length calculation David Disseldorp
2026-03-31 18:06 ` [PATCH 0/3] mount.cifs: minor buflen tracking cleanups Henrique Carvalho
2026-04-01 2:14 ` Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260331012508.17410-3-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox