Commit a06026f8 authored by simon's avatar simon

fix: remove empty bytes from password buffer in StaticAuth #116

parent 5290ac37
...@@ -16,7 +16,7 @@ export class UserPasswordPacketHandler implements IPacketHandler { ...@@ -16,7 +16,7 @@ export class UserPasswordPacketHandler implements IPacketHandler {
const username = packet.attributes['User-Name']; const username = packet.attributes['User-Name'];
let password = packet.attributes['User-Password']; let password = packet.attributes['User-Password'];
if (typeof password !== 'string' && password.indexOf(0x00) > 0) { if (Buffer.isBuffer(password) && password.indexOf(0x00) > 0) {
// check if there is a 0x00 in it, and trim it from there // check if there is a 0x00 in it, and trim it from there
password = password.slice(0, password.indexOf(0x00)); password = password.slice(0, password.indexOf(0x00));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment