Changeset 4848 for libcaca


Ignore:
Timestamp:
Nov 18, 2012, 6:54:35 PM (6 years ago)
Author:
Sam Hocevar
Message:

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>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/canvas.c

    r4369 r4848  
    11/*
    22 *  all           full libcaca API test
    3  *  Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
     3 *  Copyright (c) 2006-2012 Sam Hocevar <sam@hocevar.net>
    44 *                All Rights Reserved
    55 *
     
    5353        {
    5454            char buf[BUFSIZ];
    55             w = caca_rand(1, 1000);
     55            w = caca_rand(1, BUFSIZ - 1);
    5656            memset(buf, 'x', w);
    5757            buf[w] = '\0';
Note: See TracChangeset for help on using the changeset viewer.