diff options
author | Zach Brown <zab@redhat.com> | 2013-10-07 14:43:03 -0700 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-10-16 08:23:13 -0400 |
commit | 29340e68532ede8fef3b0d84c8d4ae0f1b000d26 (patch) | |
tree | 2be898b543b76cdc7aeefe983161b552c7384fd0 /btrfs-fragments.c | |
parent | e2da6395959c454d1e98ff03b259ddc7e96b5861 (diff) | |
download | btrfs-progs-29340e68532ede8fef3b0d84c8d4ae0f1b000d26.tar.gz |
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>
Diffstat (limited to 'btrfs-fragments.c')
-rw-r--r-- | btrfs-fragments.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/btrfs-fragments.c b/btrfs-fragments.c index 4dd9470..cedbc57 100644 --- a/btrfs-fragments.c +++ b/btrfs-fragments.c @@ -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); |