tPrevent memcpy'ing to a non-allocated memory area - ratox - FIFO based tox client
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit f10d276d4f89edf8bb5e432bfb96864219a6c20f
(DIR) parent 79669839185cf1eae193f57a0f624abac41d5cfd
(HTM) Author: z3bra <contactatz3bradotorg>
Date: Tue, 8 Nov 2016 10:00:50 +0100
Prevent memcpy'ing to a non-allocated memory area
Diffstat:
M ratox.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/ratox.c b/ratox.c
t@@ -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);