[asterisk-bugs] [JIRA] (ASTERISK-19756) Use of asprintf with MALLOC_DEBUG could corrupt memory or crash.

Corey Farrell (JIRA) noreply at issues.asterisk.org
Mon Oct 23 13:04:21 CDT 2017


     [ https://issues.asterisk.org/jira/browse/ASTERISK-19756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Corey Farrell closed ASTERISK-19756.
------------------------------------

    Resolution: Fixed

I believe this issue is fixed by astmm.h define {{ASTMM_LIBC}} which generates build errors by default if standard allocators or free are used.  It is no longer possible to 'accidentally' use the standard allocators, linking to asprintf is only possible if a source is compiled with {{#define ASTMM_LIB ASTMM_IGNORE}} before any headers are included.

> Use of asprintf with MALLOC_DEBUG could corrupt memory or crash.
> ----------------------------------------------------------------
>
>                 Key: ASTERISK-19756
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-19756
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: General
>    Affects Versions: SVN
>            Reporter: Richard Mudgett
>
> Use of asprintf() allocates a block of memory to hold the output string.  When Asterisk is compiled with the MALLOC_DEBUG option, ast_free() is no longer the same as free().  Memory allocated with malloc() must be freed with free().  Memory allocated with ast_malloc() must be freed with ast_free().
> Most of the places where asprintf() is called free the resulting buffer with ast_free() a few lines later.



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



More information about the asterisk-bugs mailing list