Module Name:    src
Committed By:   rillig
Date:           Sun Mar 13 14:49:18 UTC 2022

Modified Files:
        src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: fix off-by-one error in symbol table

No functional change since the error was in the "safe" direction.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/xlint/lint1/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.109 src/usr.bin/xlint/lint1/lex.c:1.110
--- src/usr.bin/xlint/lint1/lex.c:1.109	Sun Mar 13 14:40:36 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sun Mar 13 14:49:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.109 2022/03/13 14:40:36 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.110 2022/03/13 14:49:18 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.109 2022/03/13 14:40:36 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.110 2022/03/13 14:49:18 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -326,7 +326,7 @@ struct syms {
 static void
 syms_add(struct syms *syms, const sym_t *sym)
 {
-	while (syms->len + 1 >= syms->cap) {
+	while (syms->len >= syms->cap) {
 		syms->cap *= 2;
 		syms->items = xrealloc(syms->items,
 		    syms->cap * sizeof(syms->items[0]));

Reply via email to