mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 05:38:14 +00:00
Fixed invalid read(s) in vcard.cc
This commit is contained in:
parent
04e2b9f4b5
commit
d1f2b1d28f
1 changed files with 10 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue