[PATCH 2/4] erec: fix error markup for errors starting at column 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux