From: Alexander Mikhalitsyn Date: Mon, 12 Dec 2022 10:26:21 +0000 (+0100) Subject: state: additional check in lxc_wait to prevent OOB X-Git-Tag: v6.0.0~77^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0072919ddcf37e7277f0bc24e80a44195459cdd9;p=thirdparty%2Flxc.git state: additional check in lxc_wait to prevent OOB I can't see a real problem here, but let's just add a check just in case. Reported-by: coverity (CID #1517314) Signed-off-by: Alexander Mikhalitsyn --- diff --git a/src/lxc/state.c b/src/lxc/state.c index 5e26855d9..b4de0ea50 100644 --- a/src/lxc/state.c +++ b/src/lxc/state.c @@ -112,7 +112,7 @@ int lxc_wait(const char *lxcname, const char *states, int timeout, } TRACE("Retrieved state of container %s", lxc_state2str(state)); - if (!s[state]) + if ((state < STOPPED || state > MAX_STATE - 1) || !s[state]) return -1; return 0;