瀏覽代碼

examples: fix a potential buffer overflow in the canvas example, triggered

when BUFSIZ is smaller than 1000. Bug found and patch sent by Bastian
Märkisch <bmaerkisch@web.de>.
tags/v0.99.beta19
Sam Hocevar sam 12 年之前
父節點
當前提交
a9a6d2c6a8
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      examples/canvas.c

+ 2
- 2
examples/canvas.c 查看文件

@@ -1,6 +1,6 @@
/*
* all full libcaca API test
* Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
* Copyright (c) 2006-2012 Sam Hocevar <sam@hocevar.net>
* 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);


Loading…
取消
儲存