aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Price <anprice@redhat.com>2013-09-05 17:35:04 +0100
committerAndrew Price <anprice@redhat.com>2013-09-05 17:35:04 +0100
commit20498553106d146be743e07b6f65cd512be10c9e (patch)
tree39c214cef1ada1f626f39fa6c2e4879be363cacc
parent069b9565b5a4b75e6d484f269ad5d9bd02dbd17f (diff)
downloadiowatcher-20498553106d146be743e07b6f65cd512be10c9e.tar.gz
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--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 1444fbc..d23e3b2 100644
--- a/main.c
+++ b/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, " ");
}