Bugzilla – Attachment 2 Details for
Bug 10
sshd sometimes clears too much memory when zeroing fd_sets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Adapted version of patch originally by jlk@kamens.brookline.ma.us
openssh-3.0p1-zero.patch (text/plain), 2.09 KB, created by
Nalin Dahyabhai
on 2001-11-08 15:11:15 AEDT
(
hide
)
Description:
Adapted version of patch originally by jlk@kamens.brookline.ma.us
Filename:
MIME Type:
Creator:
Nalin Dahyabhai
Created:
2001-11-08 15:11:15 AEDT
Size:
2.09 KB
patch
obsolete
>An fd_set uses less than one byte per FD, so zeroing it out is tricky. > >--- openssh-3.0p1/channels.h Thu Oct 11 21:35:06 2001 >+++ openssh-3.0p1/channels.h Wed Nov 7 21:44:26 2001 >@@ -143,6 +143,7 @@ > void channel_set_fds(int, int, int, int, int, int); > void channel_free(Channel *); > void channel_free_all(void); >+void channel_zero_fd_set(fd_set *, int); > void channel_stop_listening(void); > > void channel_send_open(int); >--- openssh-3.0p1/channels.c Wed Nov 7 21:44:01 2001 >+++ openssh-3.0p1/channels.c Wed Nov 7 21:47:17 2001 >@@ -1564,6 +1564,12 @@ > * select bitmasks. > */ > void >+channel_zero_fd_set(fd_set *setp, int maxfdp) >+{ >+ memset(setp, 0, howmany(maxfdp + 1, NFDBITS) * sizeof(fd_mask)); >+} >+ >+void > channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, > int *nallocp, int rekeying) > { >--- openssh-3.0p1/clientloop.c Thu Oct 11 21:36:09 2001 >+++ openssh-3.0p1/clientloop.c Wed Nov 7 21:46:56 2001 >@@ -346,8 +346,8 @@ > if (session_closed && !channel_still_open() && > !packet_have_data_to_write()) { > /* clear mask since we did not call select() */ >- memset(*readsetp, 0, *maxfdp); >- memset(*writesetp, 0, *maxfdp); >+ channel_zero_fd_set(*readsetp, *maxfdp); >+ channel_zero_fd_set(*writesetp, *maxfdp); > return; > } else { > FD_SET(connection_in, *readsetp); >@@ -375,8 +375,8 @@ > * We have to return, because the mainloop checks for the flags > * set by the signal handlers. > */ >- memset(*readsetp, 0, *maxfdp); >- memset(*writesetp, 0, *maxfdp); >+ channel_zero_fd_set(*readsetp, *maxfdp); >+ channel_zero_fd_set(*writesetp, *maxfdp); > > if (errno == EINTR) > return; >--- openssh-3.0p1/serverloop.c Wed Nov 7 21:45:53 2001 >+++ openssh-3.0p1/serverloop.c Wed Nov 7 21:46:39 2001 >@@ -272,8 +272,8 @@ > ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp); > > if (ret == -1) { >- memset(*readsetp, 0, *maxfdp); >- memset(*writesetp, 0, *maxfdp); >+ channel_zero_fd_set(*readsetp, *maxfdp); >+ channel_zero_fd_set(*writesetp, *maxfdp); > if (errno != EINTR) > error("select: %.100s", strerror(errno)); > } else if (ret == 0 && client_alive_scheduled)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10
: 2