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 hang on unfinished string lite...
details: https://anonhg.NetBSD.org/src/rev/fd742a1b7f9a
branches: trunk
changeset: 1021792:fd742a1b7f9a
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jun 18 20:29:00 2021 +0000
description:
lint: fix hang on unfinished string literal at end-of-file
The input file that triggered this bug was:
a"b"c"d
Found using afl.
diffstat:
usr.bin/xlint/lint1/lex.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 974e83336894 -r fd742a1b7f9a usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Fri Jun 18 13:57:52 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Fri Jun 18 20:29:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.37 2021/06/15 20:46:45 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.38 2021/06/18 20:29:00 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.37 2021/06/15 20:46:45 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.38 2021/06/18 20:29:00 rillig Exp $");
#endif
#include <ctype.h>
@@ -1304,7 +1304,7 @@
s = xmalloc(max = 64);
len = 0;
- while ((c = get_escaped_char('"')) >= 0) {
+ while ((c = get_escaped_char('"')) > 0) {
/* +1 to reserve space for a trailing NUL character */
if (len + 1 == max)
s = xrealloc(s, max *= 2);
Home |
Main Index |
Thread Index |
Old Index