Skip to contentSkip to conversation

security_flags.inc: libidn fails to build w/ -Wformat-security

PATCH In review André Draszik 3 participants 4 messages Jun 24, 2016 – Jun 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security_flags.inc: libidn fails to build w/ -Wformat-security

From: André Draszik <[email protected]>

../../libidn-1.32/src/idn.c: In function 'main':
../../libidn-1.32/src/idn.c:172:7: error: format not a string literal and no format arguments [-Werror=format-security]

       error (0, 0, _("only one of -s, -e, -d, -a, -u or -n can be specified"));
       ^~~~~

../../libidn-1.32/src/idn.c:187:5: error: format not a string literal and no format arguments [-Werror=format-security]
fprintf (stderr, _("Type each input string on a line by itself, "
^~~~~~~
../../libidn-1.32/src/idn.c:202:4: error: format not a string literal and no format arguments [-Werror=format-security]

    error (EXIT_FAILURE, errno, _("input error"));
    ^~~~~
../../libidn-1.32/src/idn.c:220:8: error: format not a string literal and no format arguments [-Werror=format-security]
        _("could not convert from UTF-8 to UCS-4"));
        ^
../../libidn-1.32/src/idn.c:245:8: error: format not a string literal and no format arguments [-Werror=format-security]
        _("could not convert from UTF-8 to UCS-4"));
        ^
../../libidn-1.32/src/idn.c:281:6: error: format not a string literal and no format arguments [-Werror=format-security]
      _("could not convert from UTF-8 to UCS-4"));
      ^
../../libidn-1.32/src/idn.c:340:6: error: format not a string literal and no format arguments [-Werror=format-security]
      _("could not convert from UCS-4 to UTF-8"));
      ^
../../libidn-1.32/src/idn.c:364:6: error: format not a string literal and no format arguments [-Werror=format-security]
      _("could not convert from UCS-4 to UTF-8"));
      ^
../../libidn-1.32/src/idn.c:442:8: error: format not a string literal and no format arguments [-Werror=format-security]
        _("could not convert from UCS-4 to UTF-8"));
        ^
../../libidn-1.32/src/idn.c:498:6: error: format not a string literal and no format arguments [-Werror=format-security]
      _("could not convert from UTF-8 to UCS-4"));
      ^
../../libidn-1.32/src/idn.c:527:5: error: format not a string literal and no format arguments [-Werror=format-security]
     _("could not convert from UTF-8 to UCS-4"));
     ^
../../libidn-1.32/src/idn.c:540:6: error: format not a string literal and no format arguments [-Werror=format-security]
      error (EXIT_FAILURE, 0, _("could not do NFKC normalization"));
      ^~~~~
../../libidn-1.32/src/idn.c:551:5: error: format not a string literal and no format arguments [-Werror=format-security]
     _("could not convert from UTF-8 to UCS-4"));
     ^
---
 meta/conf/distro/include/security_flags.inc | 1 +
 1 file changed, 1 insertion(+)
meta/conf/distro/include/security_flags.inc +1 -0
index a7be185..3f52afb 100644
@@ -105,6 +105,7 @@ SECURITY_STRINGFORMAT_pn-expect = ""
 SECURITY_STRINGFORMAT_pn-gcc = ""
 SECURITY_STRINGFORMAT_pn-gettext = ""
 SECURITY_STRINGFORMAT_pn-kexec-tools = ""
+SECURITY_STRINGFORMAT_pn-libidn = ""
 SECURITY_STRINGFORMAT_pn-oh-puzzles = ""
 
 TARGET_CFLAGS_append_class-target = " ${SECURITY_CFLAGS}"
Signature · 1 line
2.8.1
#1 lore raw
Quoted 6 lines · André Draszik

../../libidn-1.32/src/idn.c: In function 'main':
../../libidn-1.32/src/idn.c:172:7: error: format not a string literal and no format arguments [-Werror=format-security]

       error (0, 0, _("only one of -s, -e, -d, -a, -u or -n can be

specified"));

As libidn will be dealing with data from the network it seems like the sort of package that should be built with format-security enabled. Wouldn't it be better to fix up the calls to error() instead?

Ross

#2 lore raw
Quoted 10 lines · Ross
    ../../libidn-1.32/src/idn.c: In function 'main':
    ../../libidn-1.32/src/idn.c:172:7: error: format not a string
    literal and no format arguments [-Werror=format-security]
           error (0, 0, _("only one of -s, -e, -d, -a, -u or -n can be
    specified"));

As libidn will be dealing with data from the network it seems like the sort of package that should be built with format-security enabled. Wouldn't it be better to fix up the calls to error() instead?

Also, in general the point of adding this check was that we try to fix the problems in the code. Adding packages to the list of exceptions is missing the point :)

Please write a patch - I'd say we should accept new exceptions only if fixing the code is shown to be too difficult.

Alex

#3 lore raw
Quoted 11 lines · Alexander Kanavin
Quoted 10 lines · Ross

    ../../libidn-1.32/src/idn.c: In function 'main':
    ../../libidn-1.32/src/idn.c:172:7: error: format not a string literal and no format arguments [-Werror=format-security] error (0, 0, _("only one of -s, -e, -d, -a, -u or -n can be specified"));

As libidn will be dealing with data from the network it seems like the sort of package that should be built with format-security enabled. Wouldn't it be better to fix up the calls to error() instead?

Yes, and no :-)
idn.c is a command line utility and the gcc warnings are all from error messages printed, e.g. when giving incorrect command line arguments. But it makes sense in case future versions add more issues in other places as they would go unnoticed otherwise.

Quoted 6 lines

Also, in general the point of adding this check was that we try to fix the problems in the code. Adding packages to the list of exceptions is missing the point :)

Please write a patch - I'd say we should accept new exceptions only if fixing the code is shown to be too difficult.

http://lists.openembedded.org/pipermail/openembedded-core/2016-June/123327.html

a.