All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: mhalcrow@us.ibm.com
Cc: ecryptfs@vger.kernel.org
Subject: small buffer overflow in ecryptfs_new_file_context()
Date: Sat, 31 Jan 2015 16:23:44 +0300	[thread overview]
Message-ID: <20150131132344.GA10291@mwanda> (raw)

Hello Michael Halcrow,

The patch 237fead61998: "[PATCH] ecryptfs: fs/Makefile and
fs/Kconfig" from Oct 4, 2006, leads to the following static checker
warning:

	fs/ecryptfs/crypto.c:846 ecryptfs_new_file_context()
	error: off-by-one overflow 'crypt_stat->cipher' size 32.  rl = '0-32'

fs/ecryptfs/crypto.c
   841          cipher_name_len =
   842                  strlen(mount_crypt_stat->global_default_cipher_name);
   843          memcpy(crypt_stat->cipher,
   844                 mount_crypt_stat->global_default_cipher_name,
   845                 cipher_name_len);
   846          crypt_stat->cipher[cipher_name_len] = '\0';

We're basically doing a complicated:

	strcpy(crypt_stat->cipher,
	       mount_crypt_stat->global_default_cipher_name);

But ->global_default_cipher_name has one more character than ->cipher so
it doesn't necessarily fit.

regards,
dan carpenter

                 reply	other threads:[~2015-01-31 13:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150131132344.GA10291@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=mhalcrow@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.