[asterisk-bugs] [JIRA] (ASTERISK-25720) [patch] memory allocation fix in chanvars

Badalian Vyacheslav (JIRA) noreply at issues.asterisk.org
Mon Jan 25 06:53:33 CST 2016


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

Badalian Vyacheslav edited comment on ASTERISK-25720 at 1/25/16 6:52 AM:
-------------------------------------------------------------------------

>  if (!(var = ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char)))) {

# {{sizeof(char)}} != 1 byte for some platforms....
# reallocation of char[] or char[0] its bad way for compiller optimization and kernel memory overflow detect tools becouse char[0] its stack allocated var, but you reallocate it to global memory
# unknown behavor to compiler. try {{struct A {char B[0]; char C[0];} }} . Whats size of struct? Whats address for A.B and A.C ? Different compilers do different result/


was (Author: slavon):
>  if (!(var = ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char)))) {

# {{sizeof(char)}} != 1 byte for some platforms....
# reallocation of char[] or char[0] its bad way for compiller optimization and kernel memory overflow detect tools becouse char[0] its stack allocated var, but you reallocate it to global memory

> [patch] memory allocation fix in chanvars
> -----------------------------------------
>
>                 Key: ASTERISK-25720
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25720
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/General
>    Affects Versions: 13.7.0
>            Reporter: Badalian Vyacheslav
>            Assignee: Unassigned
>         Attachments: chanvars.diff
>
>
> Founded by Asan



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



More information about the asterisk-bugs mailing list