call to memcpy().
#define STDC_HEADERS 1
/* Most recent revision number in the version control system */
-#define VCS_REVISION "219"
+#define VCS_REVISION "220"
/* Version number of package */
#define VERSION "2.10"
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-VCS_REVISION=219
+VCS_REVISION=220
cat >>confdefs.h <<_ACEOF
dnl This is the one location where the authoritative version number is stored
AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
-VCS_REVISION=219
+VCS_REVISION=220
AC_SUBST(VCS_REVISION)
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
[Most recent revision number in the version control system])
};
VT100.prototype.about = function() {
- alert("VT100 Terminal Emulator " + "2.10 (revision 219)" +
+ alert("VT100 Terminal Emulator " + "2.10 (revision 220)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com");
};
int fd) {
if (hint &&
server->connections <= hint &&
- server->connections + server->numConnections > hint &&
- &server->connections[hint - server->connections] == hint &&
- !hint->deleted &&
- server->pollFds[hint - server->connections + 1].fd == fd) {
- return hint;
+ server->connections + server->numConnections > hint) {
+ // The compiler would like to optimize the expression:
+ // &server->connections[hint - server->connections] <=>
+ // server->connections + hint - server->connections <=>
+ // hint
+ // This transformation is correct as far as the language specification is
+ // concerned, but it is unintended as we actually want to check whether
+ // the alignment is correct. So, instead of comparing
+ // &server->connections[hint - server->connections] == hint
+ // we first use memcpy() to break aliasing.
+ uintptr_t ptr1, ptr2;
+ memcpy(&ptr1, &hint, sizeof(ptr1));
+ memcpy(&ptr2, &server->connections, sizeof(ptr2));
+ int idx = (ptr1 - ptr2)/sizeof(*server->connections);
+ if (&server->connections[idx] == hint &&
+ !hint->deleted &&
+ server->pollFds[hint - server->connections + 1].fd == fd) {
+ return hint;
+ }
}
for (int i = 0; i < server->numConnections; i++) {
if (server->pollFds[i + 1].fd == fd && !server->connections[i].deleted) {
};
ShellInABox.prototype.about = function() {
- alert("Shell In A Box version " + "2.10 (revision 219)" +
+ alert("Shell In A Box version " + "2.10 (revision 220)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com" +
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
};
VT100.prototype.about = function() {
- alert("VT100 Terminal Emulator " + "2.10 (revision 219)" +
+ alert("VT100 Terminal Emulator " + "2.10 (revision 220)" +
"\nCopyright 2008-2010 by Markus Gutschke\n" +
"For more information check http://shellinabox.com");
};