diff options
author | z3bra <contactatz3bradotorg> | 2016-11-08 10:00:50 +0100 |
---|---|---|
committer | z3bra <contactatz3bradotorg> | 2016-11-08 16:47:52 +0100 |
commit | f10d276d4f89edf8bb5e432bfb96864219a6c20f (patch) | |
tree | 707d971a03ca3a1b80e4609d49c7c632191cee04 | |
parent | 79669839185cf1eae193f57a0f624abac41d5cfd (diff) |
Prevent memcpy'ing to a non-allocated memory area
-rw-r--r-- | ratox.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1006,9 +1006,9 @@ datasave(void) if (!intermediate) eprintf("malloc:"); tox_pass_encrypt(intermediate, sz - TOX_PASS_ENCRYPTION_EXTRA_LENGTH, passphrase, pplen, data, NULL); + } else { + data = intermediate; } - else - memcpy(data, intermediate, sz); if (write(fd, data, sz) != sz) eprintf("write %s:", savefile); fsync(fd); |