From: Heinrich Schuchardt Date: Fri Nov 15 17:16:40 2024 +0100 Subject: main: avoid buffer overrun Patch-mainline: Not yet Git-repo: https://git.code.sf.net/p/sispmctl/git Git-commit: f027fce54c8999ea99d669d8619906a15abfea5f References: Break will only exit the inner loop. Use goto to leave the outer loop. Addresses-Coverity-ID: 512018 Out-of-bounds write Signed-off-by: Heinrich Schuchardt Signed-off-by: Egbert Eich --- src/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index b5d0ff2..c2214e5 100644 --- a/src/main.c +++ b/src/main.c @@ -640,10 +640,11 @@ int main(int argc, char *argv[]) if (count == MAXGEMBIRD) { fprintf(stderr,"%d devices found. Please recompile if you need to " "support more devices!\n",count); - break; + goto max_gembird; } } } +max_gembird: /* bubble sort them first, thnx Ingo Flaschenberger */ if (count > 1) {