After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720081 - GTlsConnection: avoid non-literal format strings
GTlsConnection: avoid non-literal format strings
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-12-08 20:32 UTC by Allison Karlitskaya (desrt)
Modified: 2013-12-19 02:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GTlsConnection: avoid non-literal format strings (2.44 KB, patch)
2013-12-08 20:32 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2013-12-08 20:32:40 UTC
More FreeBSD/clang fallout.

Note: I tested changing one of the "%s" in the error messages to "%d"
and indeed, this is now caught and treated as an error (showing that
this approach is better in any case).
Comment 1 Allison Karlitskaya (desrt) 2013-12-08 20:32:42 UTC
Created attachment 263773 [details] [review]
GTlsConnection: avoid non-literal format strings

The error handling in GTlsConnection involved translated format strings
that were then passed to another function where the arguments were
applied.  This prevents the C compiler from enforcing restrictions on
the format string and runs afoul of -Werror=format-nonliteral, breaking
the build under clang.

Fix it up so that the error handling function takes the format string
along with the argument and calls g_error_new_valist().  This allows the
compiler to check that we're getting it right.
Comment 2 Dan Winship 2013-12-09 14:29:35 UTC
Comment on attachment 263773 [details] [review]
GTlsConnection: avoid non-literal format strings

ok, except:

>-static int
>+G_GNUC_PRINTF(5, 6) static int

same comment as in the other bug

>+  } while ((ret = end_gnutls_io (gnutls, direction, ret, err, errmsg, gnutls_strerror(ret))) == GNUTLS_E_AGAIN);

space between "gnutls_strerror" and "("
Comment 3 Allison Karlitskaya (desrt) 2013-12-09 16:27:38 UTC
Attachment 263773 [details] pushed as e9145a4 - GTlsConnection: avoid non-literal format strings
Comment 4 Dan Kegel 2013-12-19 02:44:40 UTC
This makes xcode5 / macosx 10.9 happy, thanks.