Skip to content

Commit 964d789

Browse files
author
Sam Trenholme
committed
coLunacyDNS: Fix bug where we improperly use FD_ISSET w.r.t. select()
If you use FD_ISSET on a connection never set with FD_SET, this triggers a buffer overflow in Ubuntu’s 20.04 glibc. Fixed. Found when updating tests for https://github.com/samboy/MaraDNS/issues/91 This *also* means we will need to make a coLunacyDNS 1.0.010
1 parent 3cff85f commit 964d789

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

deadwood-github/tools/coLunacyDNS/coLunacyDNS.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,8 @@ void runServer(lua_State *L) {
20652065
if(FD_ISSET(localConn4, &selectFdSet)) {
20662066
sock4 = localConn4;
20672067
selectOut -= 1;
2068-
} else if(FD_ISSET(localConn6, &selectFdSet)) {
2068+
} else if(localConn6 != INVALID_SOCKET &&
2069+
FD_ISSET(localConn6, &selectFdSet)) {
20692070
sock6 = localConn6;
20702071
selectOut -= 1;
20712072
} else {

0 commit comments

Comments
 (0)