enterfield(): test the buffer size BEFORE assignment also for the other code
branch, since we might get called with tablepos == endkey for some special input files (where an record would happen to fit exactly to the input buffer) - BTW, this bug looks like it has been here ~forever ... This seems to fix the sort crash for 'make british' build of ispell package, as reported by Mark White at current-users@.
This commit is contained in:
parent
82deda03bf
commit
21928fdd78
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fields.c,v 1.8 2001/02/19 19:41:31 jdolecek Exp $ */
|
||||
/* $NetBSD: fields.c,v 1.9 2001/02/19 19:52:27 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -41,7 +41,7 @@
|
|||
#include "sort.h"
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: fields.c,v 1.8 2001/02/19 19:41:31 jdolecek Exp $");
|
||||
__RCSID("$NetBSD: fields.c,v 1.9 2001/02/19 19:52:27 jdolecek Exp $");
|
||||
__SCCSID("@(#)fields.c 8.1 (Berkeley) 6/6/93");
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -191,9 +191,9 @@ enterfield(tablepos, endkey, cur_fld, gflags)
|
|||
*tablepos++ = lweight[1];
|
||||
*tablepos++ = lweight[*start ? 2 : 1];
|
||||
} else {
|
||||
*tablepos++ = lweight[*start];
|
||||
if (tablepos == endkey)
|
||||
if (tablepos+1 >= endkey)
|
||||
return (NULL);
|
||||
*tablepos++ = lweight[*start];
|
||||
}
|
||||
}
|
||||
*tablepos++ = lweight[0];
|
||||
|
|
Loading…
Reference in New Issue