This repository was archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 310
Wrong prefix match #53
Copy link
Copy link
Open
Description
libsignal-protocol-javascript/src/helpers.js
Lines 35 to 47 in f5a838f
| isEqual: function(a, b) { | |
| // TODO: Special-case arraybuffers, etc | |
| if (a === undefined || b === undefined) { | |
| return false; | |
| } | |
| a = util.toString(a); | |
| b = util.toString(b); | |
| var maxLength = Math.max(a.length, b.length); | |
| if (maxLength < 5) { | |
| throw new Error("a/b compare too short"); | |
| } | |
| return a.substring(0, Math.min(maxLength, a.length)) == b.substring(0, Math.min(maxLength, b.length)); | |
| } |
I think someone tried here to implement a prefix match, but it should not work, because it's the same as
return a.substring(0, a.length) == b.substring(0, b.length);
Am I right, or did I overlook something? Are you interested in a pr?
Metadata
Metadata
Assignees
Labels
No labels