Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 249888) +++ apps/app_voicemail.c (working copy) @@ -1189,6 +1189,12 @@ fprintf(text_file_ptr, "%s\n", "[message]"); cid_num = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:"); + /* get_header_by_tag() uses a global buffer and is called below to get the cid_name + * and only then both cid_num and cid_name are used; so we need to make a copy of + * cid_num (if it is not NULL) to detach from the global buffer */ + if (cid_num) { + cid_num = ast_strdupa(cid_num); + } cid_name = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:"); fprintf(text_file_ptr, "callerid=\"%s\" <%s>\n", S_OR(cid_name, ""), S_OR(cid_num, "")); context = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");