iowatcher: Fix buffer overwrite issue
authorYuanhan Liu <yliu.null@gmail.com>
Fri, 12 Oct 2012 16:09:29 +0000 (10:09 -0600)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:07 +0000 (12:02 -0700)
commitd79212594039b93458a563fb440c424146671a3b
treef1a9c4f53591ba3d8425b8c6d62d058149d4bb04
parentfb38c6653401fd5331e7fe99927d113d25b24d65
iowatcher: Fix buffer overwrite issue

Current code allocates buffer for path based on strdup, which would let
the size of path equals to the size of blktrace_dest_dir. But the code
next that joins it with the filename of dump file, which would overwrite
the buffer, and triggered an issue like following:

$ ./iowatcher -t trace.dump -o trace.svg
Unable to find trace file ./trace.dumpY
                                      ^

Refactoring join_path a bit to fix this issue.

Cc: Liu Bo <liub.liubo@gmail.com>
Signed-off-by: Yuanhan Liu <yliu.null@gmail.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
iowatcher/main.c