diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-04-02 10:04:38 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-04-02 10:04:38 +0000 |
commit | 0fd736151af57867df1e62b1c1a10d23f70b6f0e (patch) | |
tree | f620383004dc26d69f4125de06f51e1e87a08948 /usr.sbin | |
parent | cb29da6ab4c082aa7366db853e4e05815d643ff4 (diff) |
More security fixes; check type before using it as tsptype index.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/timed/timedc/cmds.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/usr.sbin/timed/timedc/cmds.c b/usr.sbin/timed/timedc/cmds.c index 958f8d95781..7881d83d540 100644 --- a/usr.sbin/timed/timedc/cmds.c +++ b/usr.sbin/timed/timedc/cmds.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)cmds.c 5.1 (Berkeley) 5/11/93"; #endif /* not lint */ #ifdef sgi -#ident "$Revision: 1.7 $" +#ident "$Revision: 1.8 $" #endif #include "timedc.h" @@ -336,8 +336,12 @@ msite(int argc, char *argv[]) printf("master timedaemon at %s is %s\n", tgtname, msg.tsp_name); } else { - printf("received wrong ack: %s\n", - tsptype[msg.tsp_type]); + if (msg.tsp_type >= TSPTYPENUMBER) + printf("received unknown ack: %u\n", + msg.tsp_type); + else + printf("received wrong ack: %s\n", + tsptype[msg.tsp_type]); } } else { printf("communication error with %s\n", tgtname); @@ -470,14 +474,19 @@ tracing(int argc, char *argv[]) return; } bytehostorder(&msg); - if (msg.tsp_type == TSP_ACK) + if (msg.tsp_type == TSP_ACK) { if (onflag) printf("timed tracing enabled\n"); else printf("timed tracing disabled\n"); - else - printf("wrong ack received: %s\n", - tsptype[msg.tsp_type]); + } else { + if (msg.tsp_type >= TSPTYPENUMBER) + printf("unknown ack received: %u\n", + msg.tsp_type); + else + printf("wrong ack received: %s\n", + tsptype[msg.tsp_type]); + } } else printf("communication error\n"); } |