]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
erec: fix error markup for errors starting at column 0
authorPatrick McHardy <kaber@trash.net>
Fri, 10 Jan 2014 09:28:37 +0000 (09:28 +0000)
committerPatrick McHardy <kaber@trash.net>
Fri, 10 Jan 2014 09:28:37 +0000 (09:28 +0000)
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

index 7451d94ca44777c92f57c8ec6dd790177c05c6ac..a157d2fa76dd3ab9e3b77e7182d4f2db8c1448cb 100644 (file)
@@ -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);
                }