"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/test-base64.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

test-base64.c  (dovecot-2.3.16):test-base64.c  (dovecot-2.3.17)
skipping to change at line 83 skipping to change at line 83
test_begin("base64_decode()"); test_begin("base64_decode()");
for (i = 0; i < N_ELEMENTS(tests); i++) { for (i = 0; i < N_ELEMENTS(tests); i++) {
/* Some of the base64_decode() callers use fixed size buffers. /* Some of the base64_decode() callers use fixed size buffers.
Use a fixed size buffer here as well to test that Use a fixed size buffer here as well to test that
base64_decode() can't allocate any extra space even base64_decode() can't allocate any extra space even
temporarily. */ temporarily. */
size_t max_decoded_size = size_t max_decoded_size =
MAX_BASE64_DECODED_SIZE(strlen(tests[i].input)); MAX_BASE64_DECODED_SIZE(strlen(tests[i].input));
buffer_create_from_data(&buf, buffer_create_from_data(&buf,
(max_decoded_size == 0 ? NULL : (max_decoded_size == 0 ? "" :
t_malloc0(max_decoded_size)), t_malloc0(max_decoded_size)),
max_decoded_size); max_decoded_size);
str = &buf; str = &buf;
ret = base64_decode(tests[i].input, strlen(tests[i].input), ret = base64_decode(tests[i].input, strlen(tests[i].input),
NULL, str); NULL, str);
test_assert_idx(tests[i].ret == ret, i); test_assert_idx(tests[i].ret == ret, i);
test_assert_idx(strlen(tests[i].output) == str_len(str) && test_assert_idx(strlen(tests[i].output) == str_len(str) &&
memcmp(tests[i].output, str_data(str), memcmp(tests[i].output, str_data(str),
str_len(str)) == 0, i); str_len(str)) == 0, i);
skipping to change at line 207 skipping to change at line 207
test_begin("base64url_decode()"); test_begin("base64url_decode()");
for (i = 0; i < N_ELEMENTS(tests); i++) { for (i = 0; i < N_ELEMENTS(tests); i++) {
/* Some of the base64_decode() callers use fixed size buffers. /* Some of the base64_decode() callers use fixed size buffers.
Use a fixed size buffer here as well to test that Use a fixed size buffer here as well to test that
base64_decode() can't allocate any extra space even base64_decode() can't allocate any extra space even
temporarily. */ temporarily. */
size_t max_decoded_size = size_t max_decoded_size =
MAX_BASE64_DECODED_SIZE(strlen(tests[i].input)); MAX_BASE64_DECODED_SIZE(strlen(tests[i].input));
buffer_create_from_data(&buf, buffer_create_from_data(&buf,
(max_decoded_size == 0 ? NULL : (max_decoded_size == 0 ? "" :
t_malloc0(max_decoded_size)), t_malloc0(max_decoded_size)),
max_decoded_size); max_decoded_size);
str = &buf; str = &buf;
ret = base64url_decode(0, tests[i].input, ret = base64url_decode(0, tests[i].input,
strlen(tests[i].input), str); strlen(tests[i].input), str);
test_assert_idx(tests[i].ret == ret, i); test_assert_idx(tests[i].ret == ret, i);
test_assert_idx(strlen(tests[i].output) == str_len(str) && test_assert_idx(strlen(tests[i].output) == str_len(str) &&
memcmp(tests[i].output, str_data(str), memcmp(tests[i].output, str_data(str),
str_len(str)) == 0, i); str_len(str)) == 0, i);
skipping to change at line 887 skipping to change at line 887
int ret; int ret;
/* Some of the base64_decode() callers use fixed size buffers. /* Some of the base64_decode() callers use fixed size buffers.
Use a fixed size buffer here as well to test that Use a fixed size buffer here as well to test that
base64_decode() can't allocate any extra space even base64_decode() can't allocate any extra space even
temporarily. */ temporarily. */
size_t max_decoded_size = size_t max_decoded_size =
MAX_BASE64_DECODED_SIZE(strlen(test->input)); MAX_BASE64_DECODED_SIZE(strlen(test->input));
buffer_create_from_data(&buf, buffer_create_from_data(&buf,
(max_decoded_size == 0 ? NULL : (max_decoded_size == 0 ? "" :
t_malloc0(max_decoded_size)), t_malloc0(max_decoded_size)),
max_decoded_size); max_decoded_size);
str = &buf; str = &buf;
base64_decode_init(&dec, test->scheme, test->flags); base64_decode_init(&dec, test->scheme, test->flags);
ret = base64_decode_more(&dec, test->input, strlen(test->input), ret = base64_decode_more(&dec, test->input, strlen(test->input),
&src_pos, str); &src_pos, str);
if (ret >= 0) if (ret >= 0)
ret = base64_decode_finish(&dec); ret = base64_decode_finish(&dec);
test_assert_idx(ret == test->ret, i); test_assert_idx(ret == test->ret, i);
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)