mailing list of musl libc
 help / color / mirror / code / Atom feed
4fa6af89d072bd8071128b85a06e92ab0da7eb8a blob 834 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
 
#include <resolv.h>
#include "libc.h"

int __dn_expand(const unsigned char *base, const unsigned char *end, const unsigned char *src, char *dest, int space)
{
	const unsigned char *p = src;
	char *dend = dest + (space > 254 ? 254 : space);
	int len = -1, i, j;
	if (p==end) return -1;
	/* detect reference loop using an iteration counter */
	for (i=0; i < end-base; i+=2) {
		if (*p & 0xc0) {
			if (p+1==end) return -1;
			j = ((p[0] & 0x3f) << 8) | p[1];
			if (len < 0) len = p+2-src;
			if (j >= end-base) return -1;
			p = base+j;
		} else if (*p) {
			j = *p++;
			if (j >= end-p || j >= dend-dest) return -1;
			while (j--) *dest++ = *p++;
			if (*p) *dest++ = '.';
		} else {
			if (dest == dend) return -1;
			*dest = 0;
			if (len < 0) len = p+1-src;
			return len;
		}
	}
	return -1;
}

weak_alias(__dn_expand, dn_expand);
debug log:

solving 4fa6af8 ...
found 4fa6af8 in https://inbox.vuxu.org/musl/20140904170726.GC10361@port70.net/
found 849df19 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 849df19a13cf918f356957e60a7bf2f45aa4618e	src/network/dn_expand.c

applying [1/1] https://inbox.vuxu.org/musl/20140904170726.GC10361@port70.net/
diff --git a/src/network/dn_expand.c b/src/network/dn_expand.c
index 849df19..4fa6af8 100644

Checking patch src/network/dn_expand.c...
Applied patch src/network/dn_expand.c cleanly.

index at:
100644 4fa6af89d072bd8071128b85a06e92ab0da7eb8a	src/network/dn_expand.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).