yooseeの日記: 編集者日記 宇宙暦 -319073.97
rsync 2.5.6 にバッファオーバーフローの脆弱性
とのこと。相当量を加筆して掲載。
しかし記事にも書いたが、diff を見ると malloc/realloc が new/realloc_array で wrap されていて、その実体は
/* Convenient wrappers for malloc and realloc. Use them. */
#define new(type) ((type *)malloc(sizeof(type)))
#define new_array(type, num) ((type *)_new_array(sizeof(type), (num)))
#define realloc_array(ptr, type, num) ((type *)_realloc_array((ptr), sizeof(type), (num)))
となっている。更に見ると
#define MALLOC_MAX 0x40000000
void *_new_array(unsigned int size, unsigned long num)
{
if (num >= MALLOC_MAX/size)
return NULL;
return malloc(size * num);
}
void *_realloc_array(void *ptr, unsigned int size, unsigned long num)
{
if (num >= MALLOC_MAX/size)
return NULL;
/* No realloc should need this, but just in case... */
if (!ptr)
return malloc(size * num);
return realloc(ptr, size * num);
}
これって素の malloc/realloc に問題がある場合があるのでその対策をしている、ように見えるけど、気のせいかな...
あまり追いきれてないので記事には変な煽りっぽい書き方になってしまった。と言うより、ああ書いておけば詳しい人が誰かばっさり解説してくれるんじゃないかなーと言う期待をしてるんだけど。
編集者日記、補足 More ログイン