[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coverity fix for games/monopoly



For this one in particular,

--- src/games/monop/houses.c.orig       Sat Mar 25 20:49:07 2006
+++ src/games/monop/houses.c    Sat Mar 25 23:42:30 2006
@@ -152,7 +152,7 @@
                        mp->sq[i]->name, pp->houses);
                input[i] = get_int(cur_prop);
                temp[i] = input[i] + pp->houses;
-               if (temp[i] > 5) {
+               if (temp[i] > 5 || temp[i] < 0) {
                        printf("That's too many.  The most you can buy is %d\n",
                                5 - pp->houses);
                                goto over;

Its trivial, I know.

player 1 (1) (cash $911) on St. James Pl. (O)
-- Command: buy houses
Pacific Ave. (G) (0) N. Carolina Ave. (G) (0) Pennsylvania Ave. (G) (0)
Houses will cost $200
How many houses do you wish to buy for
Pacific Ave. (G) (0): 99999
N. Carolina Ave. (G) (0): 99999
Pennsylvania Ave. (G) (0): 99999
You asked for -291 houses and 0 hotels for $-58200
Is that ok? yes

player 1 (1) (cash $59111) on St. James Pl. (O)

and after patch:

player 1 (1) (cash $445) on B&O RR
-- Command: buy houses
Park Place (D) (0) Boardwalk (D) (0)
Houses will cost $200
How many houses do you wish to buy for
Park Place (D) (0): 9999
That's too many.  The most you can buy is 5

I might be the only person out there who still plays these oldies but
goodies, but I'll work on a patch to overhaul the archaic and unsafe
methods used in games/ without changing game behavior, time
permitting.

On 3/25/06, Theo de Raadt <deraadt_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org> wrote:
> We still want them fixed...
>
> >
> > That puts you on Oriental Ave. (L) Owned by dingo
> > with -21 houses, rent is 1006647888
> > That leaves you $1006647673 in debt
> > How are you going to fix it up?
> > (..)
> >
> > I thought about fixing this and submitting a patch, but after some
> > consideration, I assumed the games/* were there for nostalgia, bugs
> > and all. Am I wrong?



Visit your host, monkey.org