adding onomem safeguard

doc_update_sequoia
Volker Birk 7 years ago
parent f233a934d6
commit f6a473389c

@ -752,6 +752,8 @@ DYNAMIC_API PEP_STATUS own_identities_retrieve(
sqlite3_column_int(session->own_key_is_listed, 4);
pEp_identity *ident = new_identity(address, fpr, user_id, username);
if (!ident)
goto enomem;
ident->comm_type = comm_type;
if (lang && lang[0]) {
ident->lang[0] = lang[0];

@ -979,6 +979,12 @@ DYNAMIC_API PEP_STATUS set_identity(
sqlite3_exec(session->db, "BEGIN ;", NULL, NULL, NULL);
if (identity->lang[0]) {
assert(identity->lang[0] >= 'a' && identity->lang[0] <= 'z');
assert(identity->lang[1] >= 'a' && identity->lang[1] <= 'z');
assert(identity->lang[2] == 0);
}
sqlite3_reset(session->set_person);
sqlite3_bind_text(session->set_person, 1, identity->user_id, -1,
SQLITE_STATIC);

Loading…
Cancel
Save