Skip to content

tls: fix convertALPNProtocols accepting ArrayBufferViews

Fix for ArrayBufferViews that are not Uint8Array.

I believe it should be eventually adjusted on buffer side, but not sure if it would be easy or worth potential breakage.

Audit through make test gave me two misuses, both test-only and safe: https://github.com/nodejs/node/blob/a346572b952e7942078af4105d34e049d28d3ea2/test/parallel/test-buffer-alloc.js#L46-L47 https://github.com/nodejs/node/blob/a346572b952e7942078af4105d34e049d28d3ea2/test/parallel/test-webcrypto-random.js#L50-L51

However, there could still be similar bugs within crypto in places where Buffer.from(buffer) is used.

/cc @nodejs/crypto

Merge request reports

Loading