mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
CHAOS: prevent crash on failed strdup
This patch avoids crashing on a null pointer if the strdup() allocation fails. ASTERISK-25323 Change-Id: I3f67434820ba53b53663efd6cbb42749f4f6c0f5
This commit is contained in:
committed by
Scott Griepentrog
parent
d1495bc0eb
commit
3c37c7071f
@@ -530,6 +530,10 @@ static struct msg_data* msg_data_create(const struct ast_msg *msg, const char *t
|
||||
/* Make sure we start with sip: */
|
||||
mdata->to = ast_begins_with(to, "sip:") ? ast_strdup(++to) : ast_strdup(to - 3);
|
||||
mdata->from = ast_strdup(from);
|
||||
if (!mdata->to || !mdata->from) {
|
||||
ao2_ref(mdata, -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* sometimes from can still contain the tag at this point, so remove it */
|
||||
if ((tag = strchr(mdata->from, ';'))) {
|
||||
|
Reference in New Issue
Block a user