[asterisk-bugs] [JIRA] (ASTERISK-27576) [patch] res_config_pgsql: Avoid typecasting an int to unsigned char.

Friendly Automation (JIRA) noreply at issues.asterisk.org
Sun Jan 14 09:04:49 CST 2018


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

Friendly Automation commented on ASTERISK-27576:
------------------------------------------------

Change 7944 merged by Jenkins2:
res_config_pgsql: Avoid typecasting an int to unsigned char.

[https://gerrit.asterisk.org/7944|https://gerrit.asterisk.org/7944]

> [patch] res_config_pgsql: Avoid typecasting an int to unsigned char.
> --------------------------------------------------------------------
>
>                 Key: ASTERISK-27576
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27576
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_config_pgsql
>    Affects Versions: 13.19.0, 15.2.0
>            Reporter: Alexander Traud
>            Assignee: Alexander Traud
>            Severity: Trivial
>              Labels: patch
>         Attachments: truncation_clang_pgsql.patch
>
>
> The compiler _clang_ (5.0.1) reports:{code}res_config_pgsql.c:1299:7: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]
>                                                 size < 15 ? size * 2 :
>                                                 ^~~~~~~~~~~~~~~~~~~~~~{code}
> This issue is caused by the fix for ASTERISK-27156. Previously, the compiler _gcc_ (7.2) reported:{code}res_config_pgsql.c: In function 'require_pgsql':
> res_config_pgsql.c:1298:51: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 10 [-Wformat-truncation=]
>       snprintf(fieldtype, sizeof(fieldtype), "CHAR(%d)",
>                                                    ^~
> res_config_pgsql.c:1298:45: note: directive argument in the range [-2147483648, 255]
>       snprintf(fieldtype, sizeof(fieldtype), "CHAR(%d)",
>                                              ^~~~~~~~~~{code}



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



More information about the asterisk-bugs mailing list