Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Add buffer length check in getAddressFromPublicKey #9083

Closed
ishantiw opened this issue Oct 11, 2023 · 0 comments
Closed

Add buffer length check in getAddressFromPublicKey #9083

ishantiw opened this issue Oct 11, 2023 · 0 comments

Comments

@ishantiw
Copy link
Contributor

Description

When calling getLisk32AddressFromPublicKey it accepts publicKey as an argument but by mistake users can pass any length buffer as their is no check and it can result in unintended output of the function or incorrect address which can be misleading.

Add buffer length check to atleast avoid incorrect length buffers which can alert the user if they are passing incorrect buffer. Since this function accepts publicKey we can have a length check === 32 for buffer and throw error if not.

Steps to reproduce

  • Call cryptography.address.getLisk32AddressFromPublicKey(Buffer.alloc(1)) it will result in lsk92dzwnnge9h4ynmm3tt5efz6myj4zn4gt2yh4z

Which version(s) does this affect? (Environment, OS, etc...)

v6.0.0-rc.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants