Add null character at the end of the key when storing it in a LinphoneContent (to prevent invalid reads).

This commit is contained in:
Ghislain MARY 2017-01-31 10:22:38 +01:00
parent 4eea002784
commit d2654ce519

View file

@ -185,8 +185,9 @@ void linphone_content_set_key(LinphoneContent *content, const char *key, const s
content->key = NULL;
}
if (key != NULL) {
content->key = belle_sip_malloc(keyLength);
content->key = belle_sip_malloc(keyLength + 1);
memcpy(content->key, key, keyLength);
content->key[keyLength] = '\0';
content->keyLength = keyLength;
}
}