wmgenmenu.c Removed format-truncation
commit7759d06851c2b0199bdac065f6ec67af33126c5e
authorRodolfo García Peñas (kix) <kix@kix.es>
Wed, 19 Jun 2019 19:11:04 +0000 (19 21:11 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Thu, 20 Jun 2019 21:04:31 +0000 (20 22:04 +0100)
tree6efa0107966cd459701c1e2980ef9078d73efe91
parentbf644338e4e0a3a401d3707b4bce722f09e5c821
wmgenmenu.c Removed format-truncation

This patch removes the format-truncation warning. The problem is because buf and comm are arrays with the same size (PATH_MAX). In the snprintf, comm is copied to buf, more some extra characters. The patch reduces the size for the array comm in the extra characters. Without the patch, the comm array is truncated. With the patch, the same characters are copied, without the warning.

wmgenmenu.c: In function ‘find_and_write’:
wmgenmenu.c:436:41: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
     snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
                                         ^
wmgenmenu.c:436:5: note: ‘snprintf’ output 5 or more bytes (assuming 4105) into a destination of size 4104
     snprintf(buf, sizeof(buf), "%s -e %s", terminal ? terminal : "xterm" , comm);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
util/wmgenmenu.c