[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-dev] test_memcpy() on Windows



The 'test_memcpy()' in tinytest_demo.c assumes there is a NUL in one of the buffers. (the comment says so). That's not the case here on Windows. At least not in MSVC debug-mode where malloc'ed buffers are filled with '0xCD'. A snippet from my output:

../ext/tinytest_demo.c:159: assert(db->buffer1 < db->buffer2): 537472696E67203000CDCDCDCDCDCDCDCDCDCDCDCDCD
...
vs 537472696E67203000CDCDCDCDCDCDCDCDCDCDCDCD
...
 [memcpy FAILED]

I assume this test works on Linux where AFAICS malloc() returns a buffer with zeros. If so, shouldn't calloc() be used in 'setup_data_buffer()' instead?

--gv
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev