(2-8)考察下面的代码:01 enum { BLOCK_HEADER_SIZE = 16 };02 void *AllocateBlock(size_t length) {03 struct memBlock *mBlock;04 if (length + BLOCK_HEADER_SIZE > (unsigned long long)SIZE_MAX) {05 return NULL;06 }07 mBlock = (struct memBlock *)malloc(08 length + BLOCK_HEADER_SIZE09 );10 if (!mBlock) return NULL;11 /* fill in block header and return data portion */12 return mBlock;13 }这段程序最根本的漏洞是什么( ) A: 非异常整数逻辑错误; B: 有符号整数溢出; C: 转换错误; D: 无符号整数回环。
(2-8)考察下面的代码:01 enum { BLOCK_HEADER_SIZE = 16 };02 void *AllocateBlock(size_t length) {03 struct memBlock *mBlock;04 if (length + BLOCK_HEADER_SIZE > (unsigned long long)SIZE_MAX) {05 return NULL;06 }07 mBlock = (struct memBlock *)malloc(08 length + BLOCK_HEADER_SIZE09 );10 if (!mBlock) return NULL;11 /* fill in block header and return data portion */12 return mBlock;13 }这段程序最根本的漏洞是什么( ) A: 非异常整数逻辑错误; B: 有符号整数溢出; C: 转换错误; D: 无符号整数回环。
1