Ticket #10686: 0001-libbe_build-fix-unterminated-string-in-BEntry-set.-F.patch

File 0001-libbe_build-fix-unterminated-string-in-BEntry-set.-F.patch, 995 bytes (added by jessicah, 11 years ago)
  • src/build/libbe/storage/Entry.cpp

    From bf25a3db96fd9a9d22ad78f62bd1710fc5866c27 Mon Sep 17 00:00:00 2001
    From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
    Date: Mon, 17 Mar 2014 16:19:35 +0000
    Subject: [PATCH] libbe_build: fix unterminated string in BEntry::set. Fixes
     #10686.
    
    ---
     src/build/libbe/storage/Entry.cpp | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/src/build/libbe/storage/Entry.cpp b/src/build/libbe/storage/Entry.cpp
    index 2f6accf..93dd8f8 100644
    a b BEntry::set(int dirFD, const char *path, bool traverse)  
    985985            // we need to traverse the symlink
    986986            if (--linkLimit < 0)
    987987                return B_LINK_LIMIT;
    988             size_t bufferSize = B_PATH_NAME_LENGTH;
     988            size_t bufferSize = B_PATH_NAME_LENGTH - 1;
    989989            error = _kern_read_link(dirFD, leafName, tmpPath, &bufferSize);
    990990            if (error < 0)
    991991                return error;
     992            tmpPath[bufferSize] = '\0';
    992993            path = tmpPath;
    993994            // next round...
    994995        }