lkml.org 
[lkml]   [2011]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[slabinfo PATCH] Fix off-by-one after readlink() call

    Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
    ---
    tools/slub/slabinfo.c | 2 +-
    1 files changed, 1 insertions(+), 1 deletions(-)

    diff --git a/tools/slub/slabinfo.c b/tools/slub/slabinfo.c
    index 868cc93..cc1a378 100644
    --- a/tools/slub/slabinfo.c
    +++ b/tools/slub/slabinfo.c
    @@ -1145,7 +1145,7 @@ static void read_slab_dir(void)
    switch (de->d_type) {
    case DT_LNK:
    alias->name = strdup(de->d_name);
    - count = readlink(de->d_name, buffer, sizeof(buffer));
    + count = readlink(de->d_name, buffer, sizeof(buffer)-1);

    if (count < 0)
    fatal("Cannot read symlink %s\n", de->d_name);
    --
    1.7.6.4


    \
     
     \ /
      Last update: 2011-10-14 19:31    [W:0.023 / U:31.360 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site