diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-11-02 18:13:04 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-11-02 18:13:04 +0000 |
commit | 3d4fc3222dc4f2ac4f621b71240d5df6128730ba (patch) | |
tree | 832bcf293841c17e84f5c631c52077fb0a73aa98 | |
parent | 3a3be0f62b8184560d9c50c0a2b0c5cd0d6f0c43 (diff) |
Don't access buf[strlen(buf) - 1] on empty strings.
OK moritz@.
-rw-r--r-- | games/trek/out.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/games/trek/out.c b/games/trek/out.c index 0faca7a1fbf..e8f2b63624e 100644 --- a/games/trek/out.c +++ b/games/trek/out.c @@ -1,4 +1,4 @@ -/* $OpenBSD: out.c,v 1.5 2003/06/03 03:01:42 millert Exp $ */ +/* $OpenBSD: out.c,v 1.6 2006/11/02 18:13:03 ray Exp $ */ /* $NetBSD: out.c,v 1.3 1995/04/22 10:59:16 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)out.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: out.c,v 1.5 2003/06/03 03:01:42 millert Exp $"; +static char rcsid[] = "$OpenBSD: out.c,v 1.6 2006/11/02 18:13:03 ray Exp $"; #endif #endif /* not lint */ @@ -54,7 +54,7 @@ out(dev) d = &Device[dev]; printf("%s reports %s ", d->person, d->name); - if (d->name[strlen(d->name) - 1] == 's') + if (d->name[0] != '\0' && d->name[strlen(d->name) - 1] == 's') printf("are"); else printf("is"); |