mailing list of musl libc
 help / color / mirror / code / Atom feed
eb0af1a32740955d3bc6ee4ac3ba281ad67665e0 blob 846 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
 
#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;
	int len = -1, i, j;
	if (p==end || size <= 0) return -1;
	dend = dest + (space > 254 ? 254 : space);
	if (!*p) {
		*dest = 0;
		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+1;
			if (j>=end-p || j>dend-dest) return -1;
			while (--j) *dest++ = *++p;
			*dest++ = *++p ? '.' : 0;
		} else {
			if (len < 0) len = p+1-src;
			return len;
		}
	}
	return -1;
}

weak_alias(__dn_expand, dn_expand);
debug log:

solving eb0af1a ...
found eb0af1a in https://inbox.vuxu.org/musl/20140904202053.GD23797@brightrain.aerifal.cx/
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/20140904202053.GD23797@brightrain.aerifal.cx/
diff --git a/src/network/dn_expand.c b/src/network/dn_expand.c
index 849df19..eb0af1a 100644

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

index at:
100644 eb0af1a32740955d3bc6ee4ac3ba281ad67665e0	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).