If length is 0, data should be ignored.

This commit is contained in:
Roman Pasichnyk 2015-03-25 08:41:01 +01:00
parent 45858e2678
commit 7d061e8d57

View File

@ -131,7 +131,7 @@ Tox *tox_new(const struct Tox_Options *options, const uint8_t *data, size_t leng
return NULL;
}
if (data) {
if (data && length) {
if (length < TOX_ENC_SAVE_MAGIC_LENGTH) {
SET_ERROR_PARAMETER(error, TOX_ERR_NEW_LOAD_BAD_FORMAT);
return NULL;