digitaltrails / ddcutil-service

A Dbus ddcutil server for control of DDC Monitors/VDUs
GNU General Public License v2.0
11 stars 1 forks source link

format not a string literal and no format arguments [-Werror=format-security] #13

Closed nahoj closed 6 months ago

nahoj commented 7 months ago

Hi, I just tried to build on Ubuntu 23.10 and I got the following error on make install:

gcc ddcutil-service.c -o ddcutil-service -g -Wall -Werror -std=gnu11 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/libmount -I/usr/include/blkid -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lddcutil 
ddcutil-service.c: In function ‘handle_method_call’:
ddcutil-service.c:1645:17: error: format not a string literal and no format arguments [-Werror=format-security]
 1645 |                 service_broken_error, message);
      |                 ^~~~~~~~~~~~~~~~~~~~
ddcutil-service.c: In function ‘handle_set_property’:
ddcutil-service.c:1815:9: error: format not a string literal and no format arguments [-Werror=format-security]
 1815 |         g_warning((*error)->message);
      |         ^~~~~~~~~
ddcutil-service.c:1875:13: error: format not a string literal and no format arguments [-Werror=format-security]
 1875 |             g_warning((*error)->message);
      |             ^~~~~~~~~
ddcutil-service.c:1891:13: error: format not a string literal and no format arguments [-Werror=format-security]
 1891 |             g_warning((*error)->message);
      |             ^~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:20 : ddcutil-service] Erreur 1
nahoj commented 6 months ago

Removing -Werror works as a workaround btw (compiles and seems to work fine with VDU Controls).

digitaltrails commented 6 months ago

Thanks for reporting this. I don't test on ubuntu, so you report is very helpful. It seems like ubuntu sets compilation to be more careful and has caught some potential issues. I've corrected the code, hopefully it might now build (unless it trips more checks).

nahoj commented 6 months ago

Thanks.

There's still the first error (ddcutil-service.c:1645:17).

digitaltrails commented 6 months ago

Thanks.

There's still the first error (ddcutil-service.c:1645:17).

Oops, fixed.

nahoj commented 6 months ago

Yes, clean build :+1: