[asterisk-dev] list operations in masquerade
Stanisław Pitucha
stan at gradwell.net
Wed Jun 17 06:39:56 CDT 2009
Hi all,
I've found a problem which affects local old asterisk (1.4.11), but it
seems it hasn't been fixed in trunk. I'm not even sure it will crash
the new versions. Anyways:
In ast_do_masquerade(), if the clonechan->readq is empty, it crashed
our installation.
AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list);
This macro does not check if the source list is empty, so after it
appends, original->readq->first is not NULL, but ...->last is NULL. It
causes a crash later on, as original->readq becomes broken. We fixed
it by updating the macro to:
#define AST_LIST_APPEND_LIST(head, list, field) do { \
if ((list)->first) { \
if (!(head)->first) { \
(head)->first = (list)->first; \
(head)->last = (list)->last; \
} else { \
(head)->last->field.next = (list)->first; \
(head)->last = (list)->last; \
} \
} \
(list)->first = NULL; \
(list)->last = NULL; \
} while (0)
I'm not sure if that situation is possible in trunk anymore. If
someone could confirm it's still broken, I'll just open a bug with
this patch.
--
Kind regards,
Stanisław Pitucha, Gradwell Voip Engineer
T: 01225 800 851 | F: 01225 800 801 | E: stanis at gradwell.net | www.gradwell.com
Gradwell - Internet for Business People
Phone Services | Business Broadband | Email & Website Hosting
Can switching to VoIP today put some change in your pocket?
Registered Address: 26 Cheltenham Street, Bath, BA2 3EX, UK. Company
Number: 3673235
More information about the asterisk-dev
mailing list