diff options
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | includes/hardinfo.h | 3 | ||||
| -rw-r--r-- | modules/devices/battery.c | 4 | ||||
| -rw-r--r-- | modules/devices/storage.c | 7 | ||||
| -rw-r--r-- | modules/devices/x86/processor.c | 2 | 
5 files changed, 11 insertions, 7 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index d5e5ab56..2d9632fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,8 @@ message(STATUS "Building HardInfo for architecture: ${HARDINFO_OS}-${HARDINFO_AR  add_definitions("-std=gnu89")  add_definitions("-Wno-deprecated-declarations") +add_definitions("-Werror=format") +add_definitions("-Werror=format-security")  add_subdirectory(po) diff --git a/includes/hardinfo.h b/includes/hardinfo.h index 34586549..737a854b 100644 --- a/includes/hardinfo.h +++ b/includes/hardinfo.h @@ -137,7 +137,8 @@ void	      module_unload_all(void);  const ModuleAbout  *module_get_about(ShellModule *module);  gchar        *seconds_to_string(unsigned int seconds); -gchar        *h_strdup_cprintf(const gchar *format, gchar *source, ...); +gchar        *h_strdup_cprintf(const gchar *format, gchar *source, ...) +                                __attribute__((format(gnu_printf, 1, 3)));  gchar	     *h_strconcat(gchar *string1, ...);  void          h_hash_table_remove_all (GHashTable *hash_table); diff --git a/modules/devices/battery.c b/modules/devices/battery.c index 6d50a52d..d2b7189c 100644 --- a/modules/devices/battery.c +++ b/modules/devices/battery.c @@ -82,9 +82,9 @@ __scan_battery_apcupsd(void)              battery_list = h_strdup_cprintf("[%s]\n", battery_list, ups_fields[i].key);            } else {              /* there's a name: adds a line */ +            const gchar *name = g_hash_table_lookup(ups_data, ups_fields[i].key);              battery_list = h_strdup_cprintf("%s=%s\n", battery_list, -                                            ups_fields[i].name, -                                            g_hash_table_lookup(ups_data, ups_fields[i].key)); +                                            ups_fields[i].name, name);            }          } diff --git a/modules/devices/storage.c b/modules/devices/storage.c index 4272430d..d9c8e043 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -307,7 +307,7 @@ gboolean __scan_udisks2_devices(void) {              moreinfo = h_strdup_cprintf(_("[Self-monitoring (S.M.A.R.T.)]\n"                                          "Status=%s\n"                                          "Bad Sectors=%ld\n" -                                        "Power on time=%d days %d hours\n" +                                        "Power on time=%lu days %lu hours\n"                                          "Temperature=%d°C\n"),                                          moreinfo,                                          disk->smart_failing ? _("Failing"): _("OK"), @@ -542,7 +542,8 @@ void __scan_scsi_devices(void)  void __scan_ide_devices(void)  {      FILE *proc_ide; -    gchar *device, iface, *model, *media, *pgeometry = NULL, *lgeometry = NULL; +    gchar *device, *model, *media, *pgeometry = NULL, *lgeometry = NULL; +    gchar iface;      gint n = 0, i = 0, cache, nn = 0;      gchar *capab = NULL, *speed = NULL, *driver = NULL, *ide_storage_list; @@ -690,7 +691,7 @@ void __scan_ide_devices(void)  	    gchar *devid = g_strdup_printf("IDE%d", n); -	    ide_storage_list = h_strdup_cprintf("$%s$%hd%c=|%s\n", ide_storage_list, devid, iface, model); +	    ide_storage_list = h_strdup_cprintf("$%s$hd%c=|%s\n", ide_storage_list, devid, iface, model);  	    storage_icons =  		h_strdup_cprintf("Icon$%s$%s=%s.png\n", storage_icons,  				 devid, model, g_str_equal(media, "cdrom") ? "cdrom" : "hdd"); diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c index 1985d12a..ff1374f3 100644 --- a/modules/devices/x86/processor.c +++ b/modules/devices/x86/processor.c @@ -704,7 +704,7 @@ gchar *dmi_socket_info() {              gchar *voltage_str = dmidecode_match("Voltage", &dt, &h);              gchar *max_speed_str = dmidecode_match("Max Speed", &dt, &h); -            ret = h_strdup_cprintf("[%s (%lu) %s]\n" +            ret = h_strdup_cprintf("[%s (%d) %s]\n"                              "%s=0x%x\n"                              "%s=%s\n"                              "%s=%s\n" | 
