aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Price <anprice@redhat.com>2013-09-05 17:35:04 +0100
committerChris Mason <clm@fb.com>2014-09-24 12:02:08 -0700
commit9d382df04ccc0f145e7f13a23757b3d0ba5a9524 (patch)
tree353c9df0bdc448430c0e540710de713bd8e64c25
parent7a51b395a7cf1218d2ad55008d5a64cd7721a057 (diff)
downloadblktrace-9d382df04ccc0f145e7f13a23757b3d0ba5a9524.tar.gz
iowatcher: Fix a label overflow in plot_io
The length of the label option wasn't being checked before strcpy()ing it into a char[256]. Use strncpy instead. Signed-off-by: Andrew Price <anprice@redhat.com>
-rw-r--r--iowatcher/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/iowatcher/main.c b/iowatcher/main.c
index 1444fbc..d23e3b2 100644
--- a/iowatcher/main.c
+++ b/iowatcher/main.c
@@ -747,7 +747,8 @@ static void plot_io(struct plot *plot, int min_seconds, int max_seconds, u64 min
if (!tf->label)
label[0] = 0;
else {
- strcpy(label, tf->label);
+ strncpy(label, tf->label, 255);
+ label[255] = 0;
if (io_per_process)
strcat(label, " ");
}