rockchip-linux / rkdeveloptool

GNU General Public License v2.0
146 stars 85 forks source link

fix compiling error for snprintf ( under Raspberry Pi OS Debian Bullseye ) #63

Open sprhawk opened 2 years ago

sprhawk commented 2 years ago

it compiles failed without changes:

main.cpp:1493:36: error: ‘%s’ directive output may be truncated writing up to 557 bytes into a region of size 15 [-Werror=format-truncation=]
 1493 |  snprintf(buffer, sizeof(buffer), "%s", chip);
      |                                    ^~
......
main.cpp:1493:10: note: ‘snprintf’ output between 1 and 558 bytes into a destination of size 15
 1493 |  snprintf(buffer, sizeof(buffer), "%s", chip);
      |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors