Skip to content

Commit

Permalink
Provide wrapper for fortified version of readlinkat.
Browse files Browse the repository at this point in the history
Implement wrapper that is used when -D_FORTIFY_SOURCE
is used.

Fixes: #176.

Co-authored-by: Benjamin Berg <benjamin@sipsolutions.net>
  • Loading branch information
2 people authored and martinpitt committed Apr 10, 2022
1 parent 1a8b21d commit db3b2b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libumockdev-preload.c
Expand Up @@ -1516,6 +1516,13 @@ ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz)
return r;
}

/* A readlinkat fortify wrapper that is used when -D_FORTIFY_SOURCE is used. */
ssize_t __readlinkat_chk(int dirfd, const char *pathname, char *buf, size_t bufsiz, size_t buflen);
ssize_t __readlinkat_chk(int dirfd, const char *pathname, char *buf, size_t bufsiz, size_t buflen)
{
return readlinkat(dirfd, pathname, buf, bufsiz);
}

WRAP_2ARGS_PATHRET(char *, NULL, realpath, char *);

char *__realpath_chk(const char *path, char *resolved, size_t size);
Expand Down

0 comments on commit db3b2b5

Please sign in to comment.