Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 lint: fix segmentation fault on malforme...
details: https://anonhg.NetBSD.org/src/rev/796b4dc85a2d
branches: trunk
changeset: 984334:796b4dc85a2d
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 03 20:54:08 2021 +0000
description:
lint: fix segmentation fault on malformed preprocessor output
# 0 ""
# 0 ""2
Found using afl, does not happen in practice though since every C
preprocessor generates balanced 'enter' (1) and 'leave' (2) events.
diffstat:
usr.bin/xlint/lint1/err.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (31 lines):
diff -r cb66bacbc6be -r 796b4dc85a2d usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sat Jul 03 20:43:35 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sat Jul 03 20:54:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.122 2021/06/30 14:23:50 rillig Exp $ */
+/* $NetBSD: err.c,v 1.123 2021/07/03 20:54:08 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.122 2021/06/30 14:23:50 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.123 2021/07/03 20:54:08 rillig Exp $");
#endif
#include <sys/types.h>
@@ -430,8 +430,10 @@
free(top);
top = includes;
}
- top->filename = filename;
- top->lineno = lineno;
+ if (top != NULL) {
+ top->filename = filename;
+ top->lineno = lineno;
+ }
}
}
Home |
Main Index |
Thread Index |
Old Index