netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sohny Thomas <sthomas@linux.vnet.ibm.com>
To: stephen@networkplumber.org, netdev@vger.kernel.org
Subject: [PATCH] iproute2: xfrm state add abort issue
Date: Fri, 27 Sep 2013 00:02:12 +0530	[thread overview]
Message-ID: <52447DAC.2060701@linux.vnet.ibm.com> (raw)
In-Reply-To: <524411AE.7000404@linux.vnet.ibm.com>

ip xfrm state add causes a SIGABRT due to a strncpy_chk .
This happens since strncpy doesn't account for the '\0' .
I have fixed this using sizeof  instead of strlen .

There is a redhat bug which documents this issue

https://bugzilla.redhat.com/show_bug.cgi?id=982761

Signed-off-by: Sohny Thomas <sohthoma@in.ibm.com>

--------------

diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 389942c..7dd8799 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -117,7 +117,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, 
enum xfrm_attr_type_t type,
                             char *name, char *key, char *buf, int max)
   {
          int len;
-       int slen = strlen(key);
+       int slen = sizeof(key);

   #if 0
          /* XXX: verifying both name and key is required! */

       reply	other threads:[~2013-09-26 18:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <524411AE.7000404@linux.vnet.ibm.com>
2013-09-26 18:32 ` Sohny Thomas [this message]
2013-09-27  8:26   ` [PATCH] iproute2: xfrm state add abort issue David Laight
2013-09-28 13:24     ` Sohny Thomas
2013-09-29  1:49       ` [PATCH] {iproute2, xfrm}: Use memcpy to suppress gcc phony buffer overflow warning Fan Du
2013-09-29  3:21         ` Sohny Thomas
2013-09-30  9:29           ` David Laight
2013-10-08  1:22             ` Fan Du
2013-10-01  4:10         ` Stephen Hemminger

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=52447DAC.2060701@linux.vnet.ibm.com \
    --to=sthomas@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).