Commit d1f2b1d2 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed invalid read(s) in vcard.cc

parent 04e2b9f4
......@@ -134,13 +134,17 @@ void linphone_vcard_add_sip_address(LinphoneVcard *vCard, const char *sip_addres
void linphone_vcard_remove_sip_address(LinphoneVcard *vCard, const char *sip_address) {
if (!vCard) return;
shared_ptr<belcard::BelCardImpp> impp;
for (auto it = vCard->belCard->getImpp().begin(); it != vCard->belCard->getImpp().end(); ++it) {
const char *value = (*it)->getValue().c_str();
if (strcmp(value, sip_address) == 0) {
vCard->belCard->removeImpp(*it);
impp = *it;
break;
}
}
if (impp) {
vCard->belCard->removeImpp(impp);
}
}
void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_address) {
......@@ -180,13 +184,17 @@ void linphone_vcard_add_phone_number(LinphoneVcard *vCard, const char *phone) {
void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone) {
if (!vCard) return;
shared_ptr<belcard::BelCardPhoneNumber> tel;
for (auto it = vCard->belCard->getPhoneNumbers().begin(); it != vCard->belCard->getPhoneNumbers().end(); ++it) {
const char *value = (*it)->getValue().c_str();
if (strcmp(value, phone) == 0) {
vCard->belCard->removePhoneNumber(*it);
tel = *it;
break;
}
}
if (tel) {
vCard->belCard->removePhoneNumber(tel);
}
}
bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment