Skip to content

Fix string formatting problem#85

Closed
MaksimKarpovich wants to merge 1 commit into
rockchip-linux:masterfrom
MaksimKarpovich:fix
Closed

Fix string formatting problem#85
MaksimKarpovich wants to merge 1 commit into
rockchip-linux:masterfrom
MaksimKarpovich:fix

Conversation

@MaksimKarpovich

@MaksimKarpovich MaksimKarpovich commented May 31, 2023

Copy link
Copy Markdown

solve string formatting problem (#80) with error:

make[1]: Entrando no diretório '/home/${USER}/rkdeveloptool'
g++ -DHAVE_CONFIG_H -I. -I./cfg -Wall -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -I/usr/include/libusb-1.0 -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cpp
main.cpp: In function ‘bool _Z9mergeBootv.part.0()’:
main.cpp:1493:43: error: ‘%s’ directive output may be truncated writing up to 557 bytes into a region of size 5 [-Werror=format-truncation=]
1493 | snprintf(buffer, sizeof(buffer), "%s", chip);
| ^~
......
1534 | chipType = convertChipType(chip + 2);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:894,
from DefineHeader.h:3,
from main.cpp:11:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:35: note: ‘__builtin_snprintf’ output between 1 and 558 bytes into a destination of size 5
71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:491: main.o] Erro 1
make[1]: Saindo do diretório '/home/yan/rkdeveloptool'
make: *** [Makefile:511: all-recursive] Erro 1

solve string formatting problem
@jdchmiel

jdchmiel commented Jun 9, 2023

Copy link
Copy Markdown

thankyou for this! not a C / C++ dev so this saved me time!

@renich

renich commented Aug 2, 2023

Copy link
Copy Markdown

I can confirm this fix works on Fedora 38 x86_64.

@o-murphy

Copy link
Copy Markdown

+1

@grasmanek94

Copy link
Copy Markdown

makes it compile here too.

@0xStuart

Copy link
Copy Markdown

Thanks you, worked for me.

@timblechmann

Copy link
Copy Markdown

could this patch potentially be merged? it is listed in the radxa's official build instructions: https://docs.radxa.com/en/compute-module/cm5/radxa-os/low-level-dev/rkdeveloptool?host-os=debian

@zhovner

zhovner commented Mar 18, 2025

Copy link
Copy Markdown

Fixed on #57. Can be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants