aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-02 16:59:17 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-02 16:59:17 -0700
commit854200d5862040d29366efb55317ec2ba3cd7ac4 (patch)
tree9f5abb5d58fc254e24fc5c6cf4e37bc84c0fc98a
parentd415b4145dd771c937b7295c22d01716428cb3dc (diff)
guard against exceptions in connect(), which can happen due to e.g. security violations for websockets
-rw-r--r--src/library.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index ade63d45..3a966ec8 100644
--- a/src/library.js
+++ b/src/library.js
@@ -7224,7 +7224,13 @@ LibraryManager.library = {
info.host = _gethostbyname.table[low + 0xff*high];
assert(info.host, 'problem translating fake ip ' + parts);
}
- Sockets.backends[Sockets.backend].connect(info);
+ try {
+ Sockets.backends[Sockets.backend].connect(info);
+ } catch(e) {
+ Module.printErr('Error in connect(): ' + e);
+ ___setErrNo(ERRNO_CODES.EACCES);
+ return -1;
+ }
return 0;
},