tFix possible NULL memcpy() after allocating data. - ratox - FIFO based tox client
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 704194ad52038665b64ecf6ff0e1693eff62907c
 (DIR) parent 713f9fc99f9fde976aa3f70d5db0202066c07f8a
 (HTM) Author: pranomostro <pranomestro@gmail.com>
       Date:   Mon,  5 Dec 2016 13:20:07 +0100
       
       Fix possible NULL memcpy() after allocating data.
       
       Diffstat:
         M ratox.c                             |      10 +++++-----
       
       1 file changed, 5 insertions(+), 5 deletions(-)
       ---
 (DIR) diff --git a/ratox.c b/ratox.c
       t@@ -1025,14 +1025,14 @@ datasave(void)
        
                tox_get_savedata(tox, intermediate);
        
       +        sz += encryptsavefile ? TOX_PASS_ENCRYPTION_EXTRA_LENGTH : 0;
       +        data = malloc(sz);
       +        if(!data)
       +                eprintf("malloc:");
       +
                if (encryptsavefile){
       -                sz += TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
       -                data = malloc(sz);
       -                if (!data)
       -                        eprintf("malloc:");
                        tox_pass_encrypt(intermediate, sz - TOX_PASS_ENCRYPTION_EXTRA_LENGTH, passphrase, pplen, data, NULL);
                } else {
       -                data = malloc(sz);
                        memcpy(data, intermediate, sz);
                }
                if (write(fd, data, sz) != sz)