Open QiAnXinCodeSafe opened 6 years ago
Hi all, There is a sizeof issue found by Qihoo360 CodeSafe Team. Details as bellow:
https://github.com/litecoincash-project/litecoincash/blob/3bcc790cacad47421848d821b9ba18d8c86a5f7b/src/test/serialize_tests.cpp#L363
the argument of macro 'FLATDATA' is charstrval which is a pointer defined here: https://github.com/litecoincash-project/litecoincash/blob/3bcc790cacad47421848d821b9ba18d8c86a5f7b/src/test/serialize_tests.cpp#L347
in the expand of macro 'FLATDATA' here: https://github.com/litecoincash-project/litecoincash/blob/3bcc790cacad47421848d821b9ba18d8c86a5f7b/src/serialize.h#L354 the parameter 'obj' will be used in sizeof operator. do we really need the size of a pointer of should it be the size of the string (like strlen, or sizeof of a char array )?
Can you guys confirm this?
Cheers Qihoo360 CodeSafe Team
Thanks, we'll take a look!
Maybe the 'charstrval' and FLATDATA should simply be replaced with 'stringval'. CDataStream ss2(SER_DISK, PROTOCOL_VERSION, intval, boolval, stringval, charstrval, txval);
Hi all, There is a sizeof issue found by Qihoo360 CodeSafe Team. Details as bellow:
https://github.com/litecoincash-project/litecoincash/blob/3bcc790cacad47421848d821b9ba18d8c86a5f7b/src/test/serialize_tests.cpp#L363
the argument of macro 'FLATDATA' is charstrval which is a pointer defined here: https://github.com/litecoincash-project/litecoincash/blob/3bcc790cacad47421848d821b9ba18d8c86a5f7b/src/test/serialize_tests.cpp#L347
in the expand of macro 'FLATDATA' here: https://github.com/litecoincash-project/litecoincash/blob/3bcc790cacad47421848d821b9ba18d8c86a5f7b/src/serialize.h#L354 the parameter 'obj' will be used in sizeof operator. do we really need the size of a pointer of should it be the size of the string (like strlen, or sizeof of a char array )?
Can you guys confirm this?
Cheers Qihoo360 CodeSafe Team