Opened 3 weeks ago

Closed 3 weeks ago

#27463 closed defect (fixed)

hs: rend_client_send_introduction v0 string truncation warning

Reported by: teor Owned by: teor
Priority: Medium Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 035-must, 034-must, 034-backport, 033-backport, 032-backport, 029-backport
Cc: mikeperry Actual Points:
Parent ID: #27389 Points:
Reviewer: Sponsor:

Description

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

Child Tickets

Change History (3)

comment:1 Changed 3 weeks ago by teor

Status: assignedneeds_revision

My branch rend-compiler-warning has a fix, but no changes file.

comment:2 Changed 3 weeks ago by teor

Keywords: 033-backport 032-backport 029-backport added
Status: needs_revisionneeds_review
Version: Tor: 0.3.4.1-alpha

comment:3 Changed 3 weeks ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged to 0.2.9 and forward

Note: See TracTickets for help on using tickets.