Uploaded image for project: 'Qpid Dispatch'
  1. Qpid Dispatch
  2. DISPATCH-995

gcc 8.1 format-truncation errors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • Policy Engine
    • None
      • Distribution Archlinux
      • GCC 8.1.0
      • LIBWEBSOCKETS 2.4.2
      • Python 2.7.15
      • Qpid Proton HEAD (94dfe1bf)
      • Qpid Dispatch HEAD (fe1f711e2)

    Description

      When attempting to build with gcc 8.1.0, I get several warnings-turned-errors about format-truncation:

      cmake .. \ 
      -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \
      -DPYTHON_INCLUDE_DIR=/usr/include/python2.7/ \
      -DPYTHON_LIBRARY=/lib/libpython2.7.so \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DUSE_LIBWEBSOCKETS=ON \
      -DBUILD_DOCS=OFF \
      -DUSE_VALGRIND=OFF \
      -DUSE_SANITIZERS=OFF \
      -DUSE_TSAN=OFF
      
      -- Build type is "RelWithDebInfo" (has debug symbols)
      -- The C compiler identification is GNU 8.1.0
      -- Check for working C compiler: /usr/bin/cc
      -- Check for working C compiler: /usr/bin/cc -- works
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.15") 
      -- Found PythonLibs: /lib/libpython2.7.so (found version "2.7.15") 
      -- Found Proton: optimized;/usr/lib/libqpid-proton.so;debug;/usr/lib/libqpid-proton.so (found version "0.23.0")
      -- Found LIBWEBSOCKETS: 2.4.2 
      -- Found VALGRIND: /usr/bin/valgrind 
      -- Performing Test HAS_PEDANTIC_FLAG
      -- Performing Test HAS_PEDANTIC_FLAG - Success
      -- Configuring done
      -- Generating done
      -- Build files have been written to: /tmp/qpid-dispatch/build
      
      cmake --build .
      
      [ 1%] Generating schema_enum.h, schema_enum.c
      Scanning dependencies of target qpid-dispatch
      [ 2%] Building C object src/CMakeFiles/qpid-dispatch.dir/amqp.c.o
      [ 4%] Building C object src/CMakeFiles/qpid-dispatch.dir/bitmask.c.o
      [ 5%] Building C object src/CMakeFiles/qpid-dispatch.dir/buffer.c.o
      [ 6%] Building C object src/CMakeFiles/qpid-dispatch.dir/error.c.o
      [ 8%] Building C object src/CMakeFiles/qpid-dispatch.dir/compose.c.o
      [ 9%] Building C object src/CMakeFiles/qpid-dispatch.dir/connection_manager.c.o
      [ 11%] Building C object src/CMakeFiles/qpid-dispatch.dir/container.c.o
      [ 12%] Building C object src/CMakeFiles/qpid-dispatch.dir/dispatch.c.o
      [ 13%] Building C object src/CMakeFiles/qpid-dispatch.dir/entity.c.o
      [ 15%] Building C object src/CMakeFiles/qpid-dispatch.dir/entity_cache.c.o
      [ 16%] Building C object src/CMakeFiles/qpid-dispatch.dir/failoverlist.c.o
      [ 18%] Building C object src/CMakeFiles/qpid-dispatch.dir/hash.c.o
      [ 19%] Building C object src/CMakeFiles/qpid-dispatch.dir/iovec.c.o
      [ 20%] Building C object src/CMakeFiles/qpid-dispatch.dir/iterator.c.o
      [ 22%] Building C object src/CMakeFiles/qpid-dispatch.dir/log.c.o
      [ 23%] Building C object src/CMakeFiles/qpid-dispatch.dir/message.c.o
      [ 25%] Building C object src/CMakeFiles/qpid-dispatch.dir/parse.c.o
      [ 26%] Building C object src/CMakeFiles/qpid-dispatch.dir/parse_tree.c.o
      [ 27%] Building C object src/CMakeFiles/qpid-dispatch.dir/policy.c.o
      /tmp/qpid-dispatch/src/policy.c: In function ‘_qd_policy_link_user_name_subst’:
      /tmp/qpid-dispatch/src/policy.c:532:9: error: ‘strncpy’ output truncated copying between 0 and 7 bytes from a string of length 7 [-Werror=stringop-truncation]
      strncpy(obuf, duser, copysize);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /tmp/qpid-dispatch/src/policy.c: In function ‘_qd_policy_approve_link_name’:
      /tmp/qpid-dispatch/src/policy.c:575:5: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
      strncpy(pa, allowed, a_len);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      /tmp/qpid-dispatch/src/policy.c:560:20: note: length computed here
      size_t a_len = strlen(allowed);
      ^~~~~~~~~~~~~~~
      /tmp/qpid-dispatch/src/policy.c:575:5: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
      strncpy(pa, allowed, a_len);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      /tmp/qpid-dispatch/src/policy.c:560:20: note: length computed here
      size_t a_len = strlen(allowed);
      ^~~~~~~~~~~~~~~
      cc1: all warnings being treated as errors
      make[2]: *** [src/CMakeFiles/qpid-dispatch.dir/build.make:315: src/CMakeFiles/qpid-dispatch.dir/policy.c.o] Error 1
      make[1]: *** [CMakeFiles/Makefile2:982: src/CMakeFiles/qpid-dispatch.dir/all] Error 2
      make: *** [Makefile:141: all] Error 2
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dlenoch Dominik Lenoch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: