Skip to content

Commit b9bc8c7

Browse files
ubifs: Make r5 hash binary string aware
As of now all filenames known by UBIFS are strings with a NUL terminator. With encrypted filenames a filename can be any binary string and the r5 function cannot search for the NUL terminator. UBIFS always knows how long a filename is, therefore we can change the hash function to iterate over the filename length to work correctly with binary strings. Signed-off-by: Richard Weinberger <[email protected]>
1 parent 304790c commit b9bc8c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ubifs/key.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static inline uint32_t key_r5_hash(const char *s, int len)
6969
uint32_t a = 0;
7070
const signed char *str = (const signed char *)s;
7171

72-
while (*str) {
72+
while (len--) {
7373
a += *str << 4;
7474
a += *str >> 4;
7575
a *= 11;

0 commit comments

Comments
 (0)