[OpenWrt-Devel] [PATCH 1/5] uloop: fix out-of-bound loop index.

Yousong Zhou yszhou4tech at gmail.com
Wed Jan 21 08:21:24 EST 2015


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 uloop.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/uloop.c b/uloop.c
index 9a77ce4..3224f4b 100644
--- a/uloop.c
+++ b/uloop.c
@@ -394,11 +394,11 @@ int uloop_fd_delete(struct uloop_fd *fd)
 {
 	int i;
 
-	for (i = 0; i < cur_nfds; i++) {
-		if (cur_fds[cur_fd + i].fd != fd)
+	for (i = cur_fd; i < cur_nfds; i++) {
+		if (cur_fds[i].fd != fd)
 			continue;
 
-		cur_fds[cur_fd + i].fd = NULL;
+		cur_fds[i].fd = NULL;
 	}
 
 	if (!fd->registered)
-- 
2.2.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list