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 off-by-one error in symbol table



details:   https://anonhg.NetBSD.org/src/rev/79d3a7634376
branches:  trunk
changeset: 363483:79d3a7634376
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 13 14:49:18 2022 +0000

description:
lint: fix off-by-one error in symbol table

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

diffstat:

 usr.bin/xlint/lint1/lex.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r a59f32bb8834 -r 79d3a7634376 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Mar 13 14:40:36 2022 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Mar 13 14:49:18 2022 +0000
@@ -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 @@
 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]));



Home | Main Index | Thread Index | Old Index