GH-47 Server crash in c.on('data')

This commit is contained in:
Mark Cavage 2012-01-09 08:24:14 -08:00
parent 0cee804daf
commit 040dfa51fa
1 changed files with 11 additions and 1 deletions

View File

@ -423,7 +423,17 @@ function Server(options) {
c.on('data', function(data) {
if (log.isTraceEnabled())
log.trace('data on %s: %s', c.ldap.id, util.inspect(data));
c.parser.write(data);
try {
c.parser.write(data);
} catch (e) {
log.warn('Unable to parse message [c.on(\'data\')]: %s', e.stack);
c.end(new LDAPResult({
status: 0x02,
errorMessage: e.toString(),
connection: c
}).toBer());
}
});
}; // end newConnection