ObjFW  Diff

Differences From Artifact [7ddc4e62c4]:

To Artifact [fa7a0544ce]:


193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		if ((he = gethostbyname((const void *)[host UTF8String])) ==
		    NULL || he->h_addrtype != AF_INET)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host
					error: h_errno];

		count = 0;
		for (ip = he->h_addr_list; *ip != NULL; ip++)
			count++;

		if (count == 0)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host];

		if ((ret = calloc(count + 1, sizeof(*ret))) == NULL)







|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		if ((he = gethostbyname((const void *)[host UTF8String])) ==
		    NULL || he->h_addrtype != AF_INET)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host
					error: h_errno];

		count = 0;
		for (ip = (char **)he->h_addr_list; *ip != NULL; ip++)
			count++;

		if (count == 0)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host];

		if ((ret = calloc(count + 1, sizeof(*ret))) == NULL)
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
			free(ret);
			free(results);
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: count * sizeof(*addrs)];
		}

		for (retIter = ret, resultsIter = results, addrsIter = addrs,
		    ip = he->h_addr_list; *ip != NULL;
		    retIter++, resultsIter++, addrsIter++, ip++) {
			addrsIter->sin_family = he->h_addrtype;
			addrsIter->sin_port = OF_BSWAP16_IF_LE(port);

			if ((size_t)he->h_length >
			    sizeof(addrsIter->sin_addr.s_addr))
				@throw [OFOutOfRangeException exception];







|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
			free(ret);
			free(results);
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: count * sizeof(*addrs)];
		}

		for (retIter = ret, resultsIter = results, addrsIter = addrs,
		    ip = (char **)he->h_addr_list; *ip != NULL;
		    retIter++, resultsIter++, addrsIter++, ip++) {
			addrsIter->sin_family = he->h_addrtype;
			addrsIter->sin_port = OF_BSWAP16_IF_LE(port);

			if ((size_t)he->h_length >
			    sizeof(addrsIter->sin_addr.s_addr))
				@throw [OFOutOfRangeException exception];