Prevent negative array index in function get_kev(). Valid arguments

for i are [1,1000].  This function is unused, but fix it anyway.
This commit is contained in:
bluhm
2026-06-12 12:56:39 +00:00
parent 42cae7b46c
commit 779c20457f
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -1,6 +1,7 @@
COMMENT = perl interface to the BSD kqueue system call
DISTNAME = IO-KQueue-0.39
REVISION = 0
CATEGORIES = devel
@@ -0,0 +1,14 @@
Prevent negative array index. Array has 1000 elements, i-1 is the index.
Index: KQueue.xs
--- KQueue.xs.orig
+++ KQueue.xs
@@ -143,7 +143,7 @@ get_kev(kq, i)
PREINIT:
dXSTARG;
CODE:
- if (i < 0 || i >= 1000) {
+ if (i <= 0 || i > 1000) {
croak("Invalid kevent id: %d", i);
}