From: Patrick McHardy Date: Fri, 10 Jan 2014 09:28:37 +0000 (+0000) Subject: erec: fix error markup for errors starting at column 0 X-Git-Tag: v0.099~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=806f8bba0a611fc0ce5b3104b929ce441f2b6f77;p=thirdparty%2Fnftables.git erec: fix error markup for errors starting at column 0 For errors starting at column 0, we must not subtract 1 to avoid underflow. Signed-off-by: Patrick McHardy --- diff --git a/src/erec.c b/src/erec.c index 7451d94ca..a157d2fa7 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); }