Files
sispmctl/main-avoid-buffer-overrun.patch
2025-12-16 14:15:23 +01:00

35 lines
1.0 KiB
Diff

From: Heinrich Schuchardt <xypron.glpk@gmx.de>
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 <xypron.glpk@gmx.de>
Signed-off-by: Egbert Eich <eich@suse.de>
---
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) {