iowatcher: Fix up some strcpy and strcat usage
authorAndrew Price <anprice@redhat.com>
Sun, 27 Apr 2014 05:16:01 +0000 (06:16 +0100)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:09 +0000 (12:02 -0700)
commit177d648bdd959ad4de02ca07aece5e6053682816
treefac43ae29792cb4f35fd3089babff6709d6a7a11
parent5d9d4f4c13fc6db392ffb77f4f2ccca0454275de
iowatcher: Fix up some strcpy and strcat usage

Fix an unchecked strcpy and strcat in plot_io_movie():

  $ ./iowatcher -t foo --movie -o foo.ogv -l $(printf 'x%.0s' {1..300})
  [...]
  *** buffer overflow detected ***: ./iowatcher terminated

There was also very similar code in plot_io() so a new function
plot_io_legend() was added to factor out the common string building code
and replace the buggy code with asprintf().

Also add a closedir() call to an error path in traces_list() to plug a
resource leak and make iowatcher Coverity-clean (ignoring some
false-positives).

Signed-off-by: Andrew Price <anprice@redhat.com>
iowatcher/blkparse.c
iowatcher/main.c