etesync / libetebase

The C client-side library
BSD 3-Clause "New" or "Revised" License
29 stars 9 forks source link

ETEBASE_UTILS_PRETTY_FINGERPRINT_SIZE holds wrong value #7

Closed Skycoder42 closed 1 year ago

Skycoder42 commented 1 year ago

In the current implementation, the value of ETEBASE_UTILS_PRETTY_FINGERPRINT_SIZE is wrong. If you look at https://github.com/etesync/libetebase/blob/master/src/lib.rs#L224, you can see that the size is defined as:

#[no_mangle]
pub static ETEBASE_UTILS_PRETTY_FINGERPRINT_SIZE: usize =
    1 + // Null
    4 + // Newlines
    (3 * 12) + // Spacing
    (5 * 16); // Digits
// sums up to be: 121

However, a few lines below, the fingerprint is document to have the following format:

45680   71497   88570   93128
19189   84243   25687   20837
47924   46071   54113   18789

Which means there are 2 instead of 4 newlines, only 9 spacing- and 12 digit-blocks. So, the size should actually be calculated as:

#[no_mangle]
pub static ETEBASE_UTILS_PRETTY_FINGERPRINT_SIZE: usize =
    1 + // Null
    2 + // Newlines
    (3 * 9) + // Spacing
    (5 * 12); // Digits
// sums up to be: 90