aboutsummaryrefslogtreecommitdiff
path: root/lib/io/test/xfrm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/io/test/xfrm.c')
-rw-r--r--lib/io/test/xfrm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/io/test/xfrm.c b/lib/io/test/xfrm.c
index c2e450c..184db9e 100644
--- a/lib/io/test/xfrm.c
+++ b/lib/io/test/xfrm.c
@@ -374,7 +374,6 @@ static int mem_flush(ostream_t *strm);
static ostream_t mem_ostream = {
{ 1, NULL, NULL, },
mem_append,
- NULL,
mem_flush,
NULL,
};
@@ -382,15 +381,18 @@ static ostream_t mem_ostream = {
static int mem_append(ostream_t *strm, const void *data, size_t size)
{
TEST_ASSERT(strm == &mem_ostream);
- TEST_NOT_NULL(data);
TEST_ASSERT(size > 0);
TEST_ASSERT(mo_written <= sizeof(mo_buffer));
TEST_ASSERT(size <= (sizeof(mo_buffer) - mo_written));
- memcpy(mo_buffer + mo_written, data, size);
- mo_written += size;
+ if (data == NULL) {
+ memset(mo_buffer + mo_written, 0, size);
+ } else {
+ memcpy(mo_buffer + mo_written, data, size);
+ }
+ mo_written += size;
return 0;
}