All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] isdnloop: NUL-terminate strings from userspace
Date: Mon, 31 Mar 2014 14:56:07 +0200	[thread overview]
Message-ID: <CAOMGZ=FmOPcL=d3POVM=VEA1Wu-ojUFqJuQ5KxgKB-iPfk1aiA@mail.gmail.com> (raw)
In-Reply-To: <1394189764-21754-1-git-send-email-vegard.nossum@oracle.com>

On 7 March 2014 11:56, Vegard Nossum <vegard.nossum@oracle.com> wrote:
> Both the in-kernel and BSD strlcpy() require that the source string is
> NUL terminated. We could use strncpy() + explicitly terminate the result,
> but this relies on src and dest having the same size, so the safest thing
> to do seems to explicitly terminate the source string before doing the
> strlcpy().
>
> Fixes: f9a23c84486ed35 ("isdnloop: use strlcpy() instead of strcpy()")
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: stable@vger.kernel.org
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  drivers/isdn/isdnloop/isdnloop.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
> index 02125e6..50cd348 100644
> --- a/drivers/isdn/isdnloop/isdnloop.c
> +++ b/drivers/isdn/isdnloop/isdnloop.c
> @@ -1070,6 +1070,14 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
>                 return -EBUSY;
>         if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
>                 return -EFAULT;
> +
> +       /*
> +        * Null terminate strings from userspace so we don't have to worry
> +        * about this later on.
> +        */
> +       for (i = 0; i < 3; i++)
> +               sdef.num[i][sizeof(sdef.num[0]) - 1] = '\0';
> +
>         spin_lock_irqsave(&card->isdnloop_lock, flags);
>         switch (sdef.ptype) {
>         case ISDN_PTYPE_EURO:

Ping, Dave? Just making sure this doesn't fall through the cracks. I
don't see the patch applied anywhere yet and without this patch we
still have a valid security concern IMO.


Vegard

  parent reply	other threads:[~2014-03-31 12:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 10:56 [PATCH] isdnloop: NUL-terminate strings from userspace Vegard Nossum
2014-03-07 11:26 ` Dan Carpenter
2014-03-07 11:42   ` Vegard Nossum
2014-03-07 11:52     ` Dan Carpenter
2014-03-07 12:44       ` Vegard Nossum
2014-03-07 13:05         ` Dan Carpenter
2014-03-31 12:56 ` Vegard Nossum [this message]
2014-03-31 13:36   ` Dan Carpenter
2014-03-31 13:44     ` Vegard Nossum
2014-03-31 16:48   ` David Miller
2014-04-01 10:08 Vegard Nossum
2014-04-01 10:30 ` Hannes Frederic Sowa
2014-04-01 10:46   ` Vegard Nossum
2014-04-01 11:02     ` Hannes Frederic Sowa
2014-04-01 12:35       ` Dan Carpenter
2014-04-01 20:18         ` David Miller
2014-04-01 11:23 ` YOSHIFUJI Hideaki

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='CAOMGZ=FmOPcL=d3POVM=VEA1Wu-ojUFqJuQ5KxgKB-iPfk1aiA@mail.gmail.com' \
    --to=vegard.nossum@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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.