提交 ce49cfb4 编写于 作者: E Eric Blake

bitmap: reject zero-size bitmap

* src/util/bitmap.c (virBitmapAlloc): Tighten sanity check.
上级 fa6da660
/*
* bitmap.h: Simple bitmap operations
*
* Copyright (C) 2010 Red Hat, Inc.
* Copyright (C) 2010 Novell, Inc.
*
* This library is free software; you can redistribute it and/or
......@@ -58,7 +59,7 @@ virBitmapPtr virBitmapAlloc(size_t size)
virBitmapPtr bitmap;
size_t sz;
if (SIZE_MAX - VIR_BITMAP_BITS_PER_UNIT < size)
if (SIZE_MAX - VIR_BITMAP_BITS_PER_UNIT < size || size == 0)
return NULL;
sz = (size + VIR_BITMAP_BITS_PER_UNIT - 1) /
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册