From 9d382df04ccc0f145e7f13a23757b3d0ba5a9524 Mon Sep 17 00:00:00 2001 From: Andrew Price Date: Thu, 5 Sep 2013 17:35:04 +0100 Subject: [PATCH] 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 --- iowatcher/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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, " "); } -- 2.25.1