summaryrefslogtreecommitdiff
path: root/auto_tests/tox_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/tox_test.c')
-rw-r--r--auto_tests/tox_test.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index ab2202d1..d9074ac0 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -21,6 +21,7 @@
21#include <stdlib.h> 21#include <stdlib.h>
22#include <time.h> 22#include <time.h>
23 23
24#include "../toxcore/ccompat.h"
24#include "../toxcore/tox.h" 25#include "../toxcore/tox.h"
25#include "../toxcore/util.h" 26#include "../toxcore/util.h"
26 27
@@ -125,7 +126,7 @@ static void handle_custom_packet(Tox *m, uint32_t friend_num, const uint8_t *dat
125 return; 126 return;
126 } 127 }
127 128
128 uint8_t f_data[len]; 129 VLA(uint8_t, f_data, len);
129 memset(f_data, number, len); 130 memset(f_data, number, len);
130 131
131 if (memcmp(f_data, data, len) == 0) { 132 if (memcmp(f_data, data, len) == 0) {
@@ -260,7 +261,7 @@ static void tox_file_chunk_request(Tox *tox, uint32_t friend_number, uint32_t fi
260 } 261 }
261 262
262 TOX_ERR_FILE_SEND_CHUNK error; 263 TOX_ERR_FILE_SEND_CHUNK error;
263 uint8_t f_data[length]; 264 VLA(uint8_t, f_data, length);
264 memset(f_data, sending_num, length); 265 memset(f_data, sending_num, length);
265 266
266 if (tox_file_send_chunk(tox, friend_number, file_number, position, f_data, length, &error)) { 267 if (tox_file_send_chunk(tox, friend_number, file_number, position, f_data, length, &error)) {
@@ -294,7 +295,7 @@ static void write_file(Tox *tox, uint32_t friendnumber, uint32_t filenumber, uin
294 return; 295 return;
295 } 296 }
296 297
297 uint8_t f_data[length]; 298 VLA(uint8_t, f_data, length);
298 memset(f_data, num, length); 299 memset(f_data, num, length);
299 ++num; 300 ++num;
300 301
@@ -416,7 +417,7 @@ START_TEST(test_few_clients)
416 unsigned int save_size1 = tox_get_savedata_size(tox2); 417 unsigned int save_size1 = tox_get_savedata_size(tox2);
417 ck_assert_msg(save_size1 != 0 && save_size1 < 4096, "save is invalid size %u", save_size1); 418 ck_assert_msg(save_size1 != 0 && save_size1 < 4096, "save is invalid size %u", save_size1);
418 printf("%u\n", save_size1); 419 printf("%u\n", save_size1);
419 uint8_t save1[save_size1]; 420 VLA(uint8_t, save1, save_size1);
420 tox_get_savedata(tox2, save1); 421 tox_get_savedata(tox2, save1);
421 tox_kill(tox2); 422 tox_kill(tox2);
422 423