From owner-cvs-lib Tue Mar 18 00:14:14 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id AAA12895 for cvs-lib-outgoing; Tue, 18 Mar 1997 00:14:14 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA12757; Tue, 18 Mar 1997 00:12:32 -0800 (PST) Received: from gvr.win.tue.nl (root@gvr.win.tue.nl [131.155.210.19]) by who.cdrom.com (8.8.5/8.6.11) with ESMTP id AAA28149 ; Tue, 18 Mar 1997 00:12:21 -0800 (PST) Received: (from guido@localhost) by gvr.win.tue.nl (8.8.5/8.8.2) id JAA18631; Tue, 18 Mar 1997 09:11:42 +0100 (MET) From: Guido van Rooij Message-Id: <199703180811.JAA18631@gvr.win.tue.nl> Subject: Re: cvs commit: src/lib/libtermcap tgoto.c In-Reply-To: <199703172255.JAA32577@godzilla.zeta.org.au> from Bruce Evans at "Mar 18, 97 09:55:22 am" To: bde@zeta.org.au (Bruce Evans) Date: Tue, 18 Mar 1997 09:11:41 +0100 (MET) Cc: bde@zeta.org.au, cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-lib@freefall.freebsd.org, eivind@freefall.freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-cvs-lib@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Bruce Evans wrote: > >> >I think the if statements should be something like: > >> >if (dp >= &result[MAXRETURNSIZE-1]) > >> > >> This would ensure space for the terminator, but the check at the end > >> already does that. > > > >What check? I don;t see any check. According to me, the complete buffer > > The one before the final `return ("OVERFLOW");', of course. > Argh. I was looking at the wrong place. > >can now be filled with non-NUL bytes and afterwards even extended by > >sizeof(added). If added is "", then still the NUL would be one off. > > It can be filled with non-NUL bytes, in which case the check will fail > (modulo the bug in the check that dp+strlen(added)+1 is invalid if dp > is at the end). > Okay. I thik we're in sync now ;-) -Guido