rkdeveloptool
rkdeveloptool copied to clipboard
format truncation compile error
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:36: 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);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:1493:10: note: ‘snprintf’ output between 1 and 558 bytes into a destination of size 5
1493 | snprintf(buffer, sizeof(buffer), "%s", chip);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:491: main.o] Error 1
make[1]: Leaving directory '/home/mark/pkgbuilds/rkdeveloptool'
make: *** [Makefile:511: all-recursive] Error 1
Any fix for this?
Same issue here
If you insert "-Wno-format-truncation" at line 356:
AM_CPPFLAGS = -Wall -Wno-format-truncation -Werror -Wextra -Wreturn-type -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE $(LIBUSB1_CFLAGS)
It works for me...
Edit the main.cpp line 1491 from static inline uint32_t convertChipType(const char* chip) { char buffer[5]; memset(buffer, 0, sizeof(buffer)); to static inline uint32_t convertChipType(const char* chip) { char buffer[558]; memset(buffer, 0, sizeof(buffer)); No more error.
I'll leave this open as it's a bug. But for me it's a non-issue by now. That's mainly because i'm not developing for this anymore.
Edit the main.cpp line 1491 from static inline uint32_t convertChipType(const char* chip) { char buffer[5]; memset(buffer, 0, sizeof(buffer)); to static inline uint32_t convertChipType(const char* chip) { char buffer[558]; memset(buffer, 0, sizeof(buffer)); No more error.
Yeah, it works thank you
Hi there are 2 PRs for this issue: https://github.com/rockchip-linux/rkdeveloptool/pull/63 https://github.com/rockchip-linux/rkdeveloptool/pull/62
i just wanna fix my orange pi 5 that i foolishly flashed all drives with the bootloader ......is there a prebuilt binary available for linux?
Edit the main.cpp line 1491 from static inline uint32_t convertChipType(const char* chip) { char buffer[5]; memset(buffer, 0, sizeof(buffer)); to static inline uint32_t convertChipType(const char* chip) { char buffer[558]; memset(buffer, 0, sizeof(buffer)); No more error.
I shouldn't be hard to just fix this in repo?
But there is a reason why SBC's are dying.... It is 2023 and the same issue persists.
Here fixed version of this tool https://github.com/radxa/rkdeveloptool/commits/master