• Binbin's avatar
    Fix sanitizer warning, use offsetof instread of member_offset (#11539) · ca174e1d
    Binbin authored
    
    
    In #11511 we introduced member_offset which has a sanitizer warning:
    ```
    multi.c:390:26: runtime error: member access within null pointer of type 'watchedKey' (aka 'struct watchedKey')
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior multi.c:390:26
    ```
    
    We can use offsetof() from stddef.h. This is part of the standard lib
    just to avoid this UB :) Sanitizer should not complain after we change
    this.
    
    1. Use offsetof instead of member_offset, so we can delete this now
    2. Changed (uint8_t*) cast to (char*).
    
    This does not matter much but according to standard, we are only allowed
    to cast pointers to its own type, char* and void*. Let's try to follow
    the rules.
    
    This change was suggested by tezc and the comments is also from him.
    Co-authored-by: default avatarOzan Tezcan <ozantezcan@gmail.com>
    ca174e1d
server.h 171 KB