btrfs-progs: don't overflow colors[] in fragments

Stop iteration at the number of elements in the colors[] array when
initializing the elements.  Rather than a magic number.  This was found
by static analysis.

Signed-off-by: Zach Brown <zab@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Zach Brown 2013-10-07 14:43:03 -07:00 committed by Chris Mason
parent e2da639595
commit 29340e6853
1 changed files with 1 additions and 1 deletions

View File

@ -283,7 +283,7 @@ list_fragments(int fd, u64 flags, char *dir)
white = gdImageColorAllocate(im, 255, 255, 255);
black = gdImageColorAllocate(im, 0, 0, 0);
for (j = 0; j < 10; ++j)
for (j = 0; j < ARRAY_SIZE(colors); ++j)
colors[j] = black;
init_colors(im, colors);