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

Badalian Vyacheslav (JIRA) noreply at issues.asterisk.org
Mon Jan 25 07:37:32 CST 2016


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

Badalian Vyacheslav edited comment on ASTERISK-25720 at 1/25/16 7:36 AM:
-------------------------------------------------------------------------

{{char name[0];}} - ok... this is may be corrent, but
{{char *value;}} - its POINER but you use it not for pointer!

i think my patch is clear to apply....

or you must do some one like this - 

{code}
struct A{
char * name;
char * value;
char data[0];
}

A = calloc(1, sizeof(A) + strlen(some_name)+1 + strlen(some_val)+1);

memncpy(A.data, &some_name, strlen(some_name));
a.name = &A.data; // pointer to data buffer

memncpy(A.data + strlen(some_name) +1, &some_val,strlen(some_val));
a.value = A.data + strlen(some_name)+1; // pointer to data buffer


{code}


was (Author: slavon):
{{char name[0];}} - ok... this is may be corrent, but
{{char *value;}} - its POINER but you use it not for pointer!

i think my patch is clear to apply....

> [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