netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 2/4] erec: fix error markup for errors starting at column 0
Date: Fri, 10 Jan 2014 09:31:32 +0000	[thread overview]
Message-ID: <1389346294-7242-3-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1389346294-7242-1-git-send-email-kaber@trash.net>

For errors starting at column 0, we must not subtract 1 to avoid underflow.

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 src/erec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/erec.c b/src/erec.c
index 7451d94..a157d2f 100644
--- a/src/erec.c
+++ b/src/erec.c
@@ -138,7 +138,8 @@ void erec_print(FILE *f, const struct error_record *erec)
 		end = 0;
 		for (l = erec->num_locations - 1; l >= 0; l--) {
 			loc = &erec->locations[l];
-			for (i = loc->first_column - 1; i < loc->last_column; i++)
+			for (i = loc->first_column ? loc->first_column - 1 : 0;
+			     i < loc->last_column; i++)
 				buf[i] = l ? '~' : '^';
 			end = max(end, loc->last_column);
 		}
-- 
1.8.4.2


  parent reply	other threads:[~2014-01-10  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10  9:31 [PATCH 0/4] nftables: bug fixes and minor cleanups Patrick McHardy
2014-01-10  9:31 ` [PATCH 1/4] nftables: shorten "could not process rule in batch" message Patrick McHardy
2014-01-10  9:31 ` Patrick McHardy [this message]
2014-01-10  9:31 ` [PATCH 3/4] datatype: revert "fix crash if wrong integer type is passed" Patrick McHardy
2014-01-10  9:31 ` [PATCH 4/4] meta: fix crash when parsing unresolvable mark values 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=1389346294-7242-3-git-send-email-kaber@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).