Skip to content

gt68xx backend generates compiler warnings on Debian 10

The gt68xx backend generates the following compiler warnings on Debian 10:

gt68xx.c
gt68xx.c: In function ‘download_firmware_file’:
gt68xx.c:1000:54: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
                   snprintf (filename, PATH_MAX, "%s%s%s",
                                                      ^~
gt68xx.c:1000:19: note: ‘snprintf’ output between 2 and 4352 bytes into a destination of size 4096
                   snprintf (filename, PATH_MAX, "%s%s%s",
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                             dirname, PATH_SEP, direntry->d_name);
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gt68xx.c:963:7: warning: ‘strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
       strncpy (filename, dev->model->firmware_name, PATH_MAX);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gt68xx.c:964:7: warning: ‘strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
       strncpy (dirname, dev->model->firmware_name, PATH_MAX);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gt68xx.c:968:7: warning: ‘strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
       strncpy (basename, pos + 1, PATH_MAX);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gt68xx.c:957:7: warning: ‘strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
       strncpy (basename, dev->model->firmware_name, PATH_MAX);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The warnings should be suppressed by appropriate mitigations.

Referencing issue #120 (closed)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information