[planner: 17/40] SQL plugin: fix the "format-security" warning(s)




commit ac9012fe9a6a213920216764634d4edb33656ac0
Author: Andrew Miloradovsky <miloradovsky gmail com>
Date:   Thu May 11 19:27:44 2017 +0000

    SQL plugin: fix the "format-security" warning(s)
    
    The printf's format string should always be present: at least "%s".

 libplanner/mrp-sql.c     |  4 ++--
 src/planner-sql-plugin.c | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/libplanner/mrp-sql.c b/libplanner/mrp-sql.c
index 6c66204d..31a704cd 100644
--- a/libplanner/mrp-sql.c
+++ b/libplanner/mrp-sql.c
@@ -246,7 +246,7 @@ sql_execute_command (GdaConnection *cnc, gchar *sql)
     GError *error = NULL;
     gda_connection_execute_non_select_command (cnc, sql, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
         return FALSE;
     }
@@ -273,7 +273,7 @@ sql_execute_query (GdaConnection *cnc, gchar *sql)
     GError *error = NULL;
     result = gda_connection_execute_select_command (cnc, sql, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
     }
     return result;
diff --git a/src/planner-sql-plugin.c b/src/planner-sql-plugin.c
index 5b32624c..12944977 100644
--- a/src/planner-sql-plugin.c
+++ b/src/planner-sql-plugin.c
@@ -119,14 +119,14 @@ sql_execute_batch (GdaConnection *cnc, gchar *sql)
     parser = gda_sql_parser_new ();
     batch = gda_sql_parser_parse_string_as_batch (parser, sql, NULL, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
         g_object_unref (parser);
         return FALSE;
     }
     list = gda_connection_batch_execute (cnc, batch, NULL, GDA_STATEMENT_MODEL_RANDOM_ACCESS, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
         g_object_unref (batch);
         g_object_unref (parser);
@@ -157,7 +157,7 @@ sql_execute_command (GdaConnection *cnc, gchar *sql)
     GError *error = NULL;
     gda_connection_execute_non_select_command (cnc, sql, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
         return FALSE;
     }
@@ -184,7 +184,7 @@ sql_execute_query (GdaConnection *cnc, gchar *sql)
     GError *error = NULL;
     result = gda_connection_execute_select_command (cnc, sql, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
     }
     return result;
@@ -683,7 +683,7 @@ create_database (const gchar   *dsn_name,
 
        conn = gda_connection_open_from_string(dsn->provider, init_cnc, dsn->auth_string, 0, &error);
        if (error) {
-               g_warning (error->message);
+               g_warning ("%s", error->message);
                g_clear_error (&error);
        }
        g_free(init_cnc);
@@ -730,7 +730,7 @@ sql_get_tested_connection (const gchar   *dsn_name,
 
        conn = gda_connection_open_from_dsn (dsn_name, NULL, 0, &error);
        if (error) {
-           g_warning (error->message);
+           g_warning ("%s", error->message);
            g_clear_error (&error);
        }
 
@@ -743,7 +743,7 @@ sql_get_tested_connection (const gchar   *dsn_name,
                } else {
                        conn = gda_connection_open_from_dsn (dsn_name, NULL, 0, &error);
                        if (error) {
-                           g_warning (error->message);
+                           g_warning ("%s", error->message);
                            g_clear_error (&error);
                        }
                }
@@ -1078,7 +1078,7 @@ define_dsn (const gchar *server, const gchar *port, const gchar *database, const
     dsn_info.auth_string = g_strdup_printf (AUTH_FORMAT_STRING, login, password);
     gda_config_define_dsn (&dsn_info, &error);
     if (error) {
-        g_warning (error->message);
+        g_warning ("%s", error->message);
         g_clear_error (&error);
     }
     g_free (dsn_info.cnc_string);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]