• Nils Goroll's avatar
    Advoid warning about a short strncpy · 6479a161
    Nils Goroll authored
    We added a NUL one line down, but make the compiler happy...
    
    In function ‘strncpy’,
        inlined from ‘wadj_cfg_req’ at vmod_weightadjust.c:179:10,
        inlined from ‘vmod_random_add_backend’ at vmod_weightadjust.c:300:14:
    /usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: error: ‘__builtin_strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
       95 |   return __builtin___strncpy_chk (__dest, __src, __len,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       96 |                                   __glibc_objsize (__dest));
          |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
    vmod_weightadjust.c: In function ‘vmod_random_add_backend’:
    vmod_weightadjust.c:169:36: note: length computed here
      169 |         const int reql = request ? strlen(request) + 1 : 0;
          |                                    ^~~~~~~~~~~~~~~
    6479a161
vmod_weightadjust.c 9.5 KB