[tor-bugs] #27463 [Core Tor/Tor]: hs: rend_client_send_introduction v0 string truncation warning

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Sep 5 11:12:54 UTC 2018


#27463: hs: rend_client_send_introduction v0 string truncation warning
----------------------------+----------------------------------------------
     Reporter:  teor        |      Owner:  teor
         Type:  defect      |     Status:  assigned
     Priority:  Medium      |  Milestone:  Tor: 0.3.4.x-final
    Component:  Core        |    Version:  Tor: 0.3.4.1-alpha
  Tor/Tor                   |
     Severity:  Normal      |   Keywords:  035-must, 034-must, 034-backport
Actual Points:              |  Parent ID:  #27389
       Points:              |   Reviewer:
      Sponsor:              |
----------------------------+----------------------------------------------
 {{{
 x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -I../src/ext -Isrc/ext
 -I../src/ext/trunnel -I../src/trunnel -I../src/common -Isrc/common
 -I../src/ext/trunnel -I../src/trunnel -I../src/or -Isrc/or
 -DSHARE_DATADIR="\"/mingw64/share\"" -DLOCALSTATEDIR="\"/mingw64/var\""
 -DBINDIR="\"/mingw64/bin\"" -I../src -I../src/common  -I/c/OpenSSL-
 Win64/include  -IC:/msys64/mingw64/include  -g -O2 -fasynchronous-unwind-
 tables -Wall -fno-strict-aliasing -Waddress -Warray-bounds -Wdate-time
 -Wdouble-promotion -Wduplicate-decl-specifier -Wduplicated-cond -Wextra
 -Wfloat-conversion -Wignored-attributes -Wimplicit-fallthrough -Winit-self
 -Wlogical-op -Wmissing-field-initializers -Wmissing-format-attribute
 -Wmissing-noreturn -Wnormalized=nfkc -Wnull-dereference -Woverlength-
 strings -Woverride-init -Wshadow -Wshift-count-negative -Wshift-count-
 overflow -Wshift-negative-value -Wshift-overflow=2 -Wsizeof-array-argument
 -Wstrict-overflow=1 -Wsuggest-attribute=format -Wsuggest-
 attribute=noreturn -Wswitch-bool -Wsync-nand -Wtrampolines -Wunused-but-
 set-parameter -Wunused-but-set-variable -Wunused-const-variable=2
 -Wunused-local-typedefs -Wvariadic-macros -W -Wfloat-equal -Wundef
 -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings
 -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings
 -Wnested-externs -Wbad-function-cast -Wswitch-enum -Waggregate-return
 -Wpacked -Wunused -Wunused-parameter  -Wold-style-definition -Wmissing-
 declarations -Werror -MT src/or/rendclient.o -MD -MP -MF $depbase.Tpo -c
 -o src/or/rendclient.o ../src/or/rendclient.c ...
 bash.exe : ../src/or/rendclient.c: In function
 'rend_client_send_introduction':
 At line:2 char:5
 +     & $commandPath $args 2>&1
 +     ~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : NotSpecified:
 (../src/or/rendc..._introduction'::String) [], RemoteException
     + FullyQualifiedErrorId : NativeCommandError

 ../src/or/rendclient.c:243:5: error: 'strncpy' output may be truncated
 copying 20 bytes from a string of length 41 [-Werror=stringop-truncation]
      strncpy(tmp, rendcirc->build_state->chosen_exit->nickname,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              (MAX_NICKNAME_LEN+1)); /* nul pads */
              ~~~~~~~~~~~~~~~~~~~~~
 }}}
 https://ci.appveyor.com/project/teor2345/tor/build/1.0.149/job/yttwj9fom8k0jh5c#L1253

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/27463>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list