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:
parent
e2da639595
commit
29340e6853
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue