[ircp-tray] Fix build with -Werror=format-security
Lubomir Rintel
lkundrak at fedoraproject.org
Wed Dec 4 22:43:24 UTC 2013
commit 20e772cba86df5fe0adf0a7910a1e2bfa5eeee75
Author: Lubomir Rintel <lkundrak at v3.sk>
Date: Wed Dec 4 23:43:19 2013 +0100
Fix build with -Werror=format-security
ircp-tray-0.7.6-formatsec.patch | 59 +++++++++++++++++++++++++++++++++++++++
ircp-tray.spec | 8 ++++-
2 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/ircp-tray-0.7.6-formatsec.patch b/ircp-tray-0.7.6-formatsec.patch
new file mode 100644
index 0000000..0f2baa8
--- /dev/null
+++ b/ircp-tray-0.7.6-formatsec.patch
@@ -0,0 +1,59 @@
+From 2e79ea7b3811eb922e249951d7d0c4618b8fb17c Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Wed, 4 Dec 2013 23:17:00 +0100
+Subject: [PATCH] Fix build with -Werror=format-security
+
+Fedora, starting with version 21, will enable this flag in order to limit
+potentially insecure uses of format strings. It is required for format strings
+to be constant now.
+---
+ src/recvfile.c | 5 ++---
+ src/sendfile.c | 6 +++---
+ 2 files changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/src/recvfile.c b/src/recvfile.c
+index c88c5f8..4e5f445 100644
+--- a/src/recvfile.c
++++ b/src/recvfile.c
+@@ -356,14 +356,13 @@ void recvfile_launch_dialog(char* filename_u, char** localfilename, int* fd)
+ *fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
+
+ if(*fd<0) {
+- char msgbuf[1024];
+ char* unistr;
+ GtkWidget* dialog;
+
+ unistr = g_locale_to_utf8(g_strerror(errno), -1, NULL, NULL, NULL);
+- snprintf(msgbuf, 1024, "%s, %s", _("Unable to open file for saving"), unistr);
++ dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
++ "%s, %s", _("Unable to open file for saving"), unistr);
+ g_free(unistr);
+- dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msgbuf);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ }
+diff --git a/src/sendfile.c b/src/sendfile.c
+index 0450eb8..2d859aa 100644
+--- a/src/sendfile.c
++++ b/src/sendfile.c
+@@ -122,14 +122,14 @@ struct SendSession* send_session_new(char* filename)
+ if(ircp_cli_connect(sendsess->ircp_client) < 0)
+ {
+ //error, clean and exit
+- char msgbuf[1024];
+ char* unistr;
+ GtkWidget* dialog;
+
+ unistr = g_locale_to_utf8((char*)strerror(errno), -1, NULL, NULL, NULL);
+- snprintf(msgbuf, 1024, "%s, %s", _("Unable to connect remote"), unistr);
++ dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
++ "%s, %s", _("Unable to connect remote"), unistr);
+ g_free(unistr);
+- dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msgbuf);
++
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+
+--
+1.8.4.2
+
diff --git a/ircp-tray.spec b/ircp-tray.spec
index 35fe8bd..43e6161 100644
--- a/ircp-tray.spec
+++ b/ircp-tray.spec
@@ -1,6 +1,6 @@
Name: ircp-tray
Version: 0.7.6
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Infrared file transfer tray icon
Group: Applications/Internet
@@ -10,6 +10,8 @@ Source0: http://launchpad.net/ircp-tray/0.7/%{version}/+download/%{name}-
Patch0: ircp-tray-0.7.6-sysconfig.patch
Patch1: ircp-tray-0.7.6-libnotify.patch
Patch2: ircp-tray-0.7.6-openobex17.patch
+# https://bugs.launchpad.net/ircp-tray/+bug/1257946
+Patch3: ircp-tray-0.7.6-formatsec.patch
BuildRequires: intltool gettext
BuildRequires: libnotify-devel
@@ -29,6 +31,7 @@ file out to remote devices via IrDA.
%patch0 -p1 -b .sysconfig
%patch1 -p1 -b .libnotify
%patch2 -p1 -b .openobex17
+%patch3 -p1 -b .formatsec
%build
@@ -60,6 +63,9 @@ touch --no-create %{_datadir}/icons/hicolor || :
%changelog
+* Wed Dec 04 2013 Lubomir Rintel <lkundrak at v3.sk> - 0.7.6-5
+- Fix build with -Werror=format-security
+
* Thu Oct 24 2013 Lubomir Rintel <lkundrak at v3.sk> - 0.7.6-4
- Bulk sad and useless attempt at consistent SPEC file formatting
- Fix build with openobex 1.7
More information about the scm-commits
mailing list