aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bitmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 26ebafa8c41..2c9242e3fed 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -469,6 +469,10 @@ int bitmap_scnlistprintf(char *buf, unsigned int buflen,
/* current bit is 'cur', most recently seen range is [rbot, rtop] */
int cur, rbot, rtop;
+ if (buflen == 0)
+ return 0;
+ buf[0] = 0;
+
rbot = cur = find_first_bit(maskp, nmaskbits);
while (cur < nmaskbits) {
rtop = cur;