-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbftpd-fdleak.patch
More file actions
33 lines (31 loc) · 1.05 KB
/
bftpd-fdleak.patch
File metadata and controls
33 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- bftpd-6.4/main.c
+++ bftpd-6.4/main.c
@@ -150,7 +150,7 @@
for (i = 0; i < bftpd_list_count(child_list); i++) {
childpid = bftpd_list_get(child_list, i);
if ( (childpid) && (childpid->pid == pid) ) {
- close(childpid->sock);
+ // close(childpid->sock); // FIX: No longer needed - parent closes immediately after fork
bftpd_list_del(&child_list, i);
free(childpid);
/* make sure the child is removed from the log */
@@ -307,7 +307,8 @@
} else { /* parent */
struct bftpd_childpid *tmp_pid = malloc(sizeof(struct bftpd_childpid));
tmp_pid->pid = pid;
- tmp_pid->sock = main_sock;
+ // tmp_pid->sock = main_sock; // FIX: Don't store socket - not needed
bftpd_list_add(&child_list, tmp_pid);
+ close(main_sock); // FIX: Close parent's copy immediately (key fix)
}
}
}
--- bftpd-6.4/main.h
+++ bftpd-6.4/main.h
@@ -9,7 +9,7 @@
struct bftpd_childpid {
pid_t pid;
- int sock;
+ // int sock; // FIX: Parent doesn't need to track socket FD
};
extern int global_argc;