diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-03-01 08:02:35 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-03-01 08:02:35 +0000 |
commit | b24570cabe5e0a07525ab6d0c4e037f62fc3cdd7 (patch) | |
tree | 4d71d75b5a89bd2da1d93a86ecb836bcbc232e3e | |
parent | 1bf57a4ba5744f56c6db52f701e2dc1eb9dd8a0b (diff) |
off by one in bounds test
ok claudio@
-rw-r--r-- | usr.sbin/bgpctl/output.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpctl/output_json.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index 37646a88360..ac8c2a54c99 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.13 2021/02/16 08:30:21 claudio Exp $ */ +/* $OpenBSD: output.c,v 1.14 2021/03/01 08:02:34 jsg Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -1021,7 +1021,7 @@ show_result(u_int rescode) { if (rescode == 0) printf("request processed\n"); - else if (rescode > + else if (rescode >= sizeof(ctl_res_strerror)/sizeof(ctl_res_strerror[0])) printf("unknown result error code %u\n", rescode); else diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 541685b2369..fa0321c6345 100644 --- a/usr.sbin/bgpctl/output_json.c +++ b/usr.sbin/bgpctl/output_json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output_json.c,v 1.7 2021/02/16 08:30:21 claudio Exp $ */ +/* $OpenBSD: output_json.c,v 1.8 2021/03/01 08:02:34 jsg Exp $ */ /* * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> @@ -978,7 +978,7 @@ json_result(u_int rescode) { if (rescode == 0) json_do_printf("status", "OK"); - else if (rescode > + else if (rescode >= sizeof(ctl_res_strerror)/sizeof(ctl_res_strerror[0])) { json_do_printf("status", "FAILED"); json_do_printf("error", "unknown error %d", rescode); |