-
Notifications
You must be signed in to change notification settings - Fork 8
Some objectGUID buffer cause error in escape filter function #10
base: main
Are you sure you want to change the base?
Conversation
HOTFIX : objectGUID Buffer is limited to 16 bytes. When escape function need to escape a 2 or 3byte code, if index is at the end of the buffer, error are throw because trying to access unavailable index. Fix by adding check of index position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please provide an example of what causes the issue you are attempting to solve here? Also, we will need unit tests that cover these cases.
Replace magic number by number based on buffer length
I try to retrive one user by his objectGUID from an Microsoft Active Directory with the simplified code as follow and ldap.js lib : I pass the objectGUID buffer as value field of an EqualityFilter. For some user, it works very well but for some other, I get an error : I will think about implementing a unit test for this case because we can produce many and many use case....
|
Add test for binary data ending by value that trig 2 or 3 bytes escaping UTF8. Implemented with a buffer length of 4bytes.
Hello, I have add a unit test for my usecase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run npm run lint
prior to committing your changes.
Hello, I have done changes. I wait answer about incomplete code because I don't understand... |
Search object by objectGUID in MS AD cause error for some GUID buffer.
For example with 2 real GUID :
TypeError: Cannot read properties of undefined (reading 'toString')
This is caused because GUID buffer is not representing character and sometimes, escape function try to escape 2 or 3 bytes at the last buffer byte.
Fix by checking buffer index before try to add second/third byte.