HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (06/05/90)
Sorry, you had better sent it to the referees first. Two bugs I found within a few minutes: 1) use tolower and toupper defensively, that is, check if the argument is really uppercase when using tolower. I had to fix it on our SUN here by changing the SUN include-files. sure the errors will revive when I install the next OS update. 2) file database.c, gettrav(): travel[++i]...... ^^^ When I first tested the program, i reached MAXTRAV and travel[++i].... overwrote fd1, yielding a core dump later. I am sure travel[i] is much better. This change lets the program run and lets me enter some dark caves..... C.v.W.
hall@cod.NOSC.MIL (Robert R. Hall) (06/06/90)
> From: HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) > Sorry, you had better sent it to the referees first. Nope, I wanted the novice users to try it. They are the ones that will try the unexpected (such as a port to a true Unix environment) just because they don't know that they weren't "suppose to" > Two bugs I found within a few minutes: > > 1) use tolower and toupper defensively, that is, check if the argument > is really uppercase when using tolower. > I had to fix it on our SUN here by changing the SUN include-files. > sure the errors will revive when I install the next OS update. > I don't understand. In the Minix file /usr/include/ctype.h I find with MINIX> grep -n tolower /usr/include/ctype.h 54: * The macro 'tolower' only affects upper case letters, and 'toupper' 58: * #define tolower(c) (isupper(c) ? c - 'A' + 'a' : c) 66:#define tolower(c) (__tmp = (c), isupper(__tmp) ? __tmp - 'A' + 'a' : __tmp) Your suggested defensive protection appears to be there to me. > 2) file database.c, gettrav(): > > travel[++i]...... > ^^^ > > When I first tested the program, i reached MAXTRAV and travel[++i].... > overwrote fd1, yielding a core dump later. > I am sure travel[i] is much better. This change lets the program run > and lets me enter some dark caves..... Ok correction accepted. This one got pass me because with Minix PC the address of fd1 is less than the address of travel[0] instead of greater than so some other non critical variable was getting clobbered instead.
L.Parkes@comp.vuw.ac.nz (Lloyd Parkes) (06/07/90)
In article <1939@cod.NOSC.MIL> hall@cod.NOSC.MIL (Robert R. Hall) writes: > Two bugs I found within a few minutes: > > 1) use tolower and toupper defensively, that is, check if the argument > is really uppercase when using tolower. > I had to fix it on our SUN here by changing the SUN include-files. > sure the errors will revive when I install the next OS update. > I don't understand. In the Minix file /usr/include/ctype.h I find with MINIX> grep -n tolower /usr/include/ctype.h 54: * The macro 'tolower' only affects upper case letters, and 'toupper' 58: * #define tolower(c) (isupper(c) ? c - 'A' + 'a' : c) 66:#define tolower(c) (__tmp = (c), isupper(__tmp) ? __tmp - 'A' + 'a' : __tmp) Your suggested defensive protection appears to be there to me. You should always use tolower & toupper in a defensive manner, because they are only defined for upper & lower case characters respectively. Failing to do this has caused me some headaches when porting stuff. Lloyd -- ------------------------------------------------------------------------ Lloyd Parkes | Bix Licks Stick's Tricks lloyd@comp.vuw.ac.nz | Bix Barton Master of the Rum and Uncanny ------------------------------------------------------------------------