[asterisk-bugs] [JIRA] (ASTERISK-29146) GCC Warnings: ‘%s’ directive argument is null.

Asterisk Team (JIRA) noreply at issues.asterisk.org
Fri Oct 30 03:40:15 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=252608#comment-252608 ] 

Asterisk Team commented on ASTERISK-29146:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

> GCC Warnings: ‘%s’ directive argument is null.
> ----------------------------------------------
>
>                 Key: ASTERISK-29146
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29146
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: . I did not set the category correctly.
>    Affects Versions: 16.14.0, 18.0.0
>            Reporter: Alexander Traud
>            Severity: Trivial
>
> In Ubuntu 20.10 with GCC 10.2, a simple
> {code}./configure
> make{code}gives{code}In function ‘handle_cli_indication_add’,
>     inlined from ‘handle_cli_indication_add’ at indications.c:658:14:
> indications.c:705:3: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
>   705 |   ast_log(LOG_WARNING, "Unable to register indication %s/%s\n", a->argv[2], a->argv[3]);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{code}On default, Asterisk compiles with [optimization level|http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html] 3. This warning does not happen with DONT_OPTIMIZE, which is level 0, which we developers use normally. Actually, GCC sees that argv\[3\] might be NULL when logging this warning. And NULL is not a good value for built-in functions, [see…|http://stackoverflow.com/q/11589342]
> While debugging this GCC warning, I changed {{ast_strlen_zero()}} in the file {{include/strings.h}} to return just {{return (!s);}}. That revealed another four places in code which are called with a NULL value always:{code}In function ‘add_calltoken_ignore’,
>     inlined from ‘set_config’ at chan_iax2.c:13817:8:
> chan_iax2.c:2803:3: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
>  2803 |   ast_log(LOG_WARNING, "invalid calltokenoptional %s\n", addr);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function ‘proc_422_rsp’,
>     inlined from ‘handle_response_invite’ at chan_sip.c:24453:3:
> chan_sip.c:30384:3: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
> 30384 |   ast_log(LOG_WARNING, "422 response without a Min-SE header %s\n", p_hdrval);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from .../include/asterisk/lock.h:63,
>                  from chan_sip.c:236:
> chan_sip.c: In function ‘handle_request_subscribe’:
> .../include/asterisk/logger.h:447:4: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
>   447 |    ast_log(AST_LOG_DEBUG, __VA_ARGS__); \
>       |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> chan_sip.c:28804:4: note: in expansion of macro ‘ast_debug’
> 28804 |    ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", accept);
>       |    ^~~~~~~~~
> chan_sip.c:28804:72: note: format string is defined here
> 28804 |    ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", accept);
>       |                                                                        ^~
> res_stir_shaken.c: In function ‘stir_shaken_read’:
> res_stir_shaken.c:1202:3: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
>  1202 |   ast_log(LOG_ERROR, "Retrieving a value using %s requires two paramaters (index, value) "
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  1203 |    "- only index was given (%s)\n", function, second);
>       |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> res_stir_shaken.c:1203:29: note: format string is defined here
>  1203 |    "- only index was given (%s)\n", function, second);
>       |                             ^~{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list