[OasisOLC] Oasis OLC 2.0.1 Bounds Checking in {x}list commands

From: Ken Ray (kenr86@hotmail.com)
Date: 05/16/03


I found a few bugs in genolc.c code.  All to do with parm bounds checking -
if you type in:

rlist 186

to list all rooms in zone 186 (and assume zone 186 is the top zone), it says

"Values must be between 0 and 18647"

The problem is that the max is actually the real top room - but if you enter
just a zone, it translates this to

rlist <starting room in zone> <ending room in zone>

where these values are from the zone file.  Most of these have first room as
xx00 and last as xx99.  So rlist 186 becomes rlist 18600 18699.  And 18699
is greater than the actual top room number.

mlist and olist are similarly affected.

Plus slist wants a "real zone number", but somehow screws up the conversion
from virtual to real.  I couldn't understand why you can't just enter

slist 30

for all shops in zone 30.

Now maybe this is fixed in Oasis 2.0.3.  Maybe not :(

Here is a simple solution - in ACMD(do_builder_list) - at the end of
genolc.c, there is a switch statement that calculates the value of "max"
based on the subcommand.  Replace it with:

  switch (subcmd) {
    case SCMD_RLIST: max = (world[top_of_world].number / 100 + 1) * 100;
break;
    case SCMD_OLIST: max = (obj_index[top_of_objt].vnum / 100 + 1) * 100;
break;
    case SCMD_MLIST: max = (mob_index[top_of_mobt].vnum / 100 + 1) * 100;
break;
    case SCMD_TLIST: max = (zone_table[top_of_zone_table].top / 100 + 1) *
100; break;
    case SCMD_SLIST: max = zone_table[top_of_zone_table].number; break;
    default: return;
  }

Yeah, I know a bit of a kludge, but it means max will actually be 18700.
Things now work.

Ken Ray

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT