From c2102d683f9b3f2233afc48e363f7a87c38b85ba Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 1 Mar 2021 08:02:34 +0000 Subject: [PATCH] off by one in bounds test ok claudio@ --- usr.sbin/bgpctl/output.c | 4 ++-- 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 @@ -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 @@ -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); -- 2.20.1