mirror of https://github.com/lukechilds/node.git
Browse Source
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: https://github.com/nodejs/node/pull/8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>v4.x
committed by
Myles Borins
2 changed files with 20 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
if (!common.hasCrypto) { |
|||
common.skip('missing crypto'); |
|||
return; |
|||
} |
|||
|
|||
const assert = require('assert'); |
|||
const tls = require('tls'); |
|||
|
|||
{ |
|||
const buffer = Buffer.from('abcd'); |
|||
const out = {}; |
|||
tls.convertNPNProtocols(buffer, out); |
|||
out.NPNProtocols.write('efgh'); |
|||
assert(buffer.equals(Buffer.from('abcd'))); |
|||
assert(out.NPNProtocols.equals(Buffer.from('efgh'))); |
|||
} |
Loading…
Reference in new issue