mailing list of musl libc
 help / color / mirror / code / Atom feed
7e39754d2c823e712140b6c3e3d56060a9749e88 blob 3029 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 
#include <poll.h>
#include <sys/socket.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <wchar.h>
#include "atomic.h"

ssize_t __read_chk(int fd, void *buf, size_t count, size_t buflen)
{
	if (count > buflen) a_crash();
	return read(fd, buf, count);
}

ssize_t __readlink_chk(const char *path, void *buf, size_t bufsize, size_t buflen)
{
	if (bufsize > buflen) a_crash();
	return readlink(path, buf, bufsize);
}

ssize_t __readlinkat_chk(int fd, const char *path, void *buf, size_t bufsize, size_t buflen)
{
	if (bufsize > buflen) a_crash();
	return readlinkat(fd, path, buf, bufsize);
}

ssize_t __recv_chk(int fd, void *buf, size_t len, size_t buflen, int flags)
{
	if (len > buflen) a_crash();
	return recv(fd, buf, len, flags);
}

ssize_t __recvfrom_chk(int fd, void *buf, size_t len, size_t buflen, int flags, struct sockaddr *addr, socklen_t *alen)
{
	if (len > buflen) a_crash();
	return recvfrom(fd, buf, len, flags, addr, alen);
}

int __open_2(const char *path, int flag)
{
	if (flag & O_CREAT) a_crash();
	return open(path, flag);
}

int __open64_2(const char *path, int flag)
{
	return __open_2(path, flag);
}

int __openat_2(int fd, const char *path, int flag)
{
	if (flag & O_CREAT) a_crash();
	return openat(fd, path, flag);
}

int __openat64_2(int fd, const char *path, int flag)
{
	return __openat_2(fd, path, flag);
}

int __poll_chk(struct pollfd *fds, nfds_t n, int timeout,  size_t fdslen)
{
	if (fdslen / sizeof(fds[0]) < n) a_crash();
	return poll(fds, n, timeout);
}

ssize_t __pread_chk(int fd, void *buf, size_t size, size_t ofs, size_t buflen)
{
	if (size > buflen) a_crash();
	return pread(fd, buf, size, ofs);
}

ssize_t __pread64_chk(int fd, void *buf, size_t size, size_t ofs, size_t buflen)
{
	return __pread_chk(fd, buf, size, ofs, buflen);
}

char *__getcwd_chk(char *buf, size_t len, size_t buflen)
{
	if (len > buflen) a_crash();
	return getcwd(buf, len);
}

int __gethostname_chk(char *name, size_t len, size_t namelen)
{
	if (len > namelen) a_crash();
	return gethostname(name, len);
}

long __fdelt_chk(long d)
{
	if (d < 0 || d >= FD_SETSIZE) a_crash();
	return d / (8 * sizeof(d));
}

int __ttyname_r_chk(int fd, char *name, size_t size, size_t namelen)
{
	if (size > namelen) a_crash();
	return ttyname_r(fd, name, size);
}

char *__stpcpy_chk(char *d, const char *s, size_t dlen)
{
	size_t slen = strnlen(s, dlen) + 1;
	if (slen > dlen) a_crash();
	return stpcpy(d, s);
}

char *__stpncpy_chk(char *d, const char *s, size_t n, size_t dlen)
{
	if (n > dlen) a_crash();
	return stpncpy(d, s, n);
}

wchar_t *__wcpcpy_chk(wchar_t *restrict d, const wchar_t *restrict s, size_t dlen)
{
	size_t slen = strnlen(s, dlen) + 1;
	if (slen > dlen) a_crash();
	return wcpcpy(d, s);
}

wchar_t *__wcpncpy_chk(wchar_t *restrict d, const wchar_t *restrict s, size_t n, size_t dlen)
{
	if (n > dlen) a_crash();
	return wcpncpy(d, s, n);
}

int __getgroups_chk(int count, gid_t list[], size_t len)
{
	if (count > len / sizeof(list[0])) a_crash();
	return getgroups(count, list);
}
debug log:

solving 7e39754 ...
found 7e39754 in https://inbox.vuxu.org/musl/1434509291-28997-1-git-send-email-josiahw@gmail.com/

applying [1/1] https://inbox.vuxu.org/musl/1434509291-28997-1-git-send-email-josiahw@gmail.com/
diff --git a/src/compat/posix_chk.c b/src/compat/posix_chk.c
new file mode 100644
index 0000000..7e39754

Checking patch src/compat/posix_chk.c...
Applied patch src/compat/posix_chk.c cleanly.

index at:
100644 7e39754d2c823e712140b6c3e3d56060a9749e88	src/compat/posix_chk.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).