netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: off by one in update_nl_seq()
Date: Sun, 27 Dec 2009 15:12:30 +0200	[thread overview]
Message-ID: <20091227131229.GH6075@bicker> (raw)

net/netfilter/nf_conntrack_ftp.c
   321  /* We don't update if it's older than what we have. */
   322  static void update_nl_seq(struct nf_conn *ct, u32 nl_seq,
   323                            struct nf_ct_ftp_master *info, int dir,
   324                            struct sk_buff *skb)
   325  {
   326          unsigned int i, oldest = NUM_SEQ_TO_REMEMBER;

Should this be oldest = NUM_SEQ_TO_REMEMBER - 1;?  The array is 
defined as:
u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];

   327
   328          /* Look for oldest: if we find exact match, we're done. */
   329          for (i = 0; i < info->seq_aft_nl_num[dir]; i++) {
   330                  if (info->seq_aft_nl[dir][i] == nl_seq)
   331                          return;
   332
   333                  if (oldest == info->seq_aft_nl_num[dir] ||
   334                      before(info->seq_aft_nl[dir][i],
   335                             info->seq_aft_nl[dir][oldest]))  

Line 335 has the possible array out of bounds I am concerned about. 

regards,
dan carpenter

             reply	other threads:[~2009-12-27 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-27 13:12 Dan Carpenter [this message]
2010-01-05  7:43 ` off by one in update_nl_seq() Patrick McHardy

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=20091227131229.GH6075@bicker \
    --to=error27@gmail.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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 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).