[anjuta] Fix format string vulnerability by using g_set_error_literal ()
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] Fix format string vulnerability by using g_set_error_literal ()
- Date: Tue, 4 Oct 2011 01:04:11 +0000 (UTC)
commit fa547401997c3fecb1ef500d3b496ceeb413a0e2
Author: Michael Biebl <biebl debian org>
Date: Tue Oct 4 01:08:27 2011 +0200
Fix format string vulnerability by using g_set_error_literal ()
plugins/am-project/am-project.c | 18 ++++++++++++++----
plugins/mk-project/mk-project.c | 15 ++++++++++++---
2 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index ca3f6b0..05c6d8f 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -1651,11 +1651,21 @@ amp_project_load_root (AmpProject *project, GError **error)
if (project->configure_token == NULL)
{
- g_set_error (error, IANJUTA_PROJECT_ERROR,
+ if (err != NULL)
+ {
+ g_set_error_literal (error, IANJUTA_PROJECT_ERROR,
+ IANJUTA_PROJECT_ERROR_PROJECT_MALFORMED,
+ err->message);
+ g_error_free (err);
+ }
+ else
+ {
+ g_set_error (error, IANJUTA_PROJECT_ERROR,
IANJUTA_PROJECT_ERROR_PROJECT_MALFORMED,
- err == NULL ? _("Unable to parse project file") : err->message);
- if (err != NULL) g_error_free (err);
- return FALSE;
+ _("Unable to parse project file"));
+ }
+
+ return FALSE;
}
/* Load all makefiles recursively */
diff --git a/plugins/mk-project/mk-project.c b/plugins/mk-project/mk-project.c
index 65dc5d7..27a09cf 100644
--- a/plugins/mk-project/mk-project.c
+++ b/plugins/mk-project/mk-project.c
@@ -486,10 +486,19 @@ project_load_makefile (MkpProject *project, GFile *file, MkpGroup *parent, GErro
mkp_scanner_free (scanner);
if (!ok)
{
- g_set_error (error, IANJUTA_PROJECT_ERROR,
+ if (err != NULL)
+ {
+ g_set_error_literal (error, IANJUTA_PROJECT_ERROR,
IANJUTA_PROJECT_ERROR_PROJECT_MALFORMED,
- err == NULL ? _("Unable to parse make file") : err->message);
- if (err != NULL) g_error_free (err);
+ err->message);
+ g_error_free (err);
+ }
+ else
+ {
+ g_set_error (error, IANJUTA_PROJECT_ERROR,
+ IANJUTA_PROJECT_ERROR_PROJECT_MALFORMED,
+ _("Unable to parse make file"));
+ }
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]