diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-08-23 00:57:45 +0200 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2014-09-05 09:34:37 -0700 |
commit | 150d6f124942617428c36728c023341c83166449 (patch) | |
tree | 68cdfa4a70802f7decc986ee35e4bc9986a362fb /lib/_http_common.js | |
parent | 8e6706ea95c81534357c84237f561a0a8073c38e (diff) | |
download | android-node-v8-150d6f124942617428c36728c023341c83166449.tar.gz android-node-v8-150d6f124942617428c36728c023341c83166449.tar.bz2 android-node-v8-150d6f124942617428c36728c023341c83166449.zip |
lib: http: poison parser references after freeing
Make it a little harder to slip in use-after-free bugs by nulling out
references to the parser object after handing it off to freeParser().
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'lib/_http_common.js')
-rw-r--r-- | lib/_http_common.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/_http_common.js b/lib/_http_common.js index f3d9d4a2eb..7994cdd98d 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -192,7 +192,7 @@ exports.parsers = parsers; // up by doing `parser.data = {}`, which should // be done in FreeList.free. `parsers.free(parser)` // should be all that is needed. -function freeParser(parser, req) { +function freeParser(parser, req, socket) { if (parser) { parser._headers = []; parser.onIncoming = null; @@ -207,6 +207,9 @@ function freeParser(parser, req) { if (req) { req.parser = null; } + if (socket) { + socket.parser = null; + } } exports.freeParser = freeParser; |