If none of the boarding parties are set do not fall off the end of the
list. Addresses Coverity CID 1507. Also put pointers before shorts in a struct rather than mixing them up
This commit is contained in:
parent
de119fc4bd
commit
a3edf3e145
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.27 2004/02/08 00:32:48 jsm Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.28 2006/03/18 01:43:52 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -148,8 +148,8 @@ struct logs {
|
|||
};
|
||||
|
||||
struct BP {
|
||||
short turnsent;
|
||||
struct ship *toship;
|
||||
short turnsent;
|
||||
short mensent;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pl_5.c,v 1.17 2004/11/05 21:30:32 dsl Exp $ */
|
||||
/* $NetBSD: pl_5.c,v 1.18 2006/03/18 01:43:52 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: pl_5.c,v 1.17 2004/11/05 21:30:32 dsl Exp $");
|
||||
__RCSID("$NetBSD: pl_5.c,v 1.18 2006/03/18 01:43:52 abs Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -218,7 +218,7 @@ parties(struct ship *to, int *crew, int isdefense, int buf)
|
|||
ptr = isdefense ? to->file->DBP : to->file->OBP;
|
||||
for (j = 0; j < NBP && ptr[j].turnsent; j++)
|
||||
;
|
||||
if (!ptr[j].turnsent && buf > '0') {
|
||||
if (j < NBP && !ptr[j].turnsent && buf > '0') {
|
||||
men = 0;
|
||||
for (k = 0; k < 3 && buf > '0'; k++) {
|
||||
men += crew[k]
|
||||
|
|
Loading…
Reference in New Issue