From a9a6d2c6a8005263a7fbf6a70bf9bacf7a4d4c0f Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 18 Nov 2012 17:54:35 +0000 Subject: [PATCH] =?UTF-8?q?examples:=20fix=20a=20potential=20buffer=20over?= =?UTF-8?q?flow=20in=20the=20canvas=20example,=20triggered=20when=20BUFSIZ?= =?UTF-8?q?=20is=20smaller=20than=201000.=20Bug=20found=20and=20patch=20se?= =?UTF-8?q?nt=20by=20Bastian=20M=C3=A4rkisch=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/canvas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/canvas.c b/examples/canvas.c index c827c7f..a304d54 100644 --- a/examples/canvas.c +++ b/examples/canvas.c @@ -1,6 +1,6 @@ /* * all full libcaca API test - * Copyright (c) 2006-2010 Sam Hocevar + * Copyright (c) 2006-2012 Sam Hocevar * All Rights Reserved * * This program is free software. It comes without any warranty, to @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) for(j = 0; j < ITER; j++) { char buf[BUFSIZ]; - w = caca_rand(1, 1000); + w = caca_rand(1, BUFSIZ - 1); memset(buf, 'x', w); buf[w] = '\0'; caca_set_frame_name(cv, buf);