Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make print methods in libnml/rcs/rcs_print.cc handle any size strings #1922

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 16, 2022

  1. Make print methods in libnml/rcs/rcs_print.cc handle any size strings

    Rewrite rcs_vprint(), rcs_print() and rcs_print_sys_error() to always print
    full string and drop use of static fixed size temp string.  Also make sure
    trailing NUL is counted when copying strings into list of last errors.
    Set output limit to 2^16 to avoid any malloc bombs.
    
    This is the warning.
    
    Compiling libnml/rcs/rcs_print.cc
    In file included from /usr/include/string.h:495,
                     from libnml/rcs/rcs_print.cc:21:
    In function ‘char* strncpy(char*, const char*, size_t)’,
        inlined from ‘int rcs_vprint(const char*, __va_list_tag*, int)’ at libnml/rcs/rcs_print.cc:311:9:
    /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output may be truncated copying 99 bytes from a string of length 255 [-Wstringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    petterreinholdtsen committed Aug 16, 2022
    Configuration menu
    Copy the full SHA
    08e6c4a View commit details
    Browse the repository at this point in the history