Commit e0baa7e
committed
tests: bound-check descriptors before FD_SET in bandwidth server
The benchmark server inserted the listen socket and every accepted client
socket into a stack fd_set with FD_SET and no FD_SETSIZE check. With
enough open descriptors, accept() returns a descriptor >= FD_SETSIZE and
FD_SET then writes out of bounds of the fd_set (stack corruption).
Refuse/close descriptors >= FD_SETSIZE before FD_SET. A real server
should use poll()/epoll(). Project Vanessa L021/L022 (CWE-787).
Reported-by: Aaron (NVIDIA)1 parent a1edd13 commit e0baa7e
1 file changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
77 | 87 | | |
78 | 88 | | |
79 | 89 | | |
| |||
106 | 116 | | |
107 | 117 | | |
108 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
109 | 128 | | |
110 | 129 | | |
111 | 130 | | |
| |||
0 commit comments