[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] readlink(2) semantics

From: Christian Weisgerber
Subject: [Bug-tar] readlink(2) semantics
Date: Thu, 22 Apr 2004 17:47:28 +0200
User-agent: Mutt/

>From 1.13.94 (and earlier), src/compare.c, ~line 325:

    case SYMTYPE:
        size_t len = strlen (current_stat_info.link_name);
        char *linkbuf = alloca (len + 1);

        status = readlink (current_stat_info.file_name, linkbuf, len + 1);

        if (status < 0)
        else if (status != len
                 || strncmp (current_stat_info.link_name, linkbuf, len) != 0)

readlink(2) does NOT append a \0 character to the buffer, so the
len+1 allocation doesn't make sense here and passing len+1 to
readlink() is wrong.

Christian "naddy" Weisgerber                          address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]